ACK: [PATCH 2/4] lib: fwts_ipmi: remove redundant for loop
Alex Hung
alex.hung at canonical.com
Wed Jun 1 00:35:39 UTC 2016
On 2016-05-31 06:42 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> The for loop is redundant; it never gets to the end to do more than
> 1 loop; so remove the loop. Instead, return if the poll failed or
> timed out. This simplifies the code and keeps the same functionality.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/lib/src/fwts_ipmi.c | 16 ++++++----------
> 1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/src/lib/src/fwts_ipmi.c b/src/lib/src/fwts_ipmi.c
> index f5f5a56..d4492cc 100644
> --- a/src/lib/src/fwts_ipmi.c
> +++ b/src/lib/src/fwts_ipmi.c
> @@ -55,16 +55,12 @@ int fwts_ipmi_exec_query(
> return FWTS_ERROR;
> }
>
> - for (;;) {
> - fwts_pfd.events = POLLIN | POLLPRI;
> - fwts_pfd.fd = fd;
> - fwts_pollfd_rc = poll(&fwts_pfd,1,5000);
> - if (fwts_pollfd_rc > 0) {
> - break;
> - } else {
> - close(fd);
> - return FWTS_ERROR;
> - }
> + fwts_pfd.events = POLLIN | POLLPRI;
> + fwts_pfd.fd = fd;
> + fwts_pollfd_rc = poll(&fwts_pfd, 1, 5000);
> + if (fwts_pollfd_rc <= 0) {
> + close(fd);
> + return FWTS_ERROR;
> }
>
> memset(&recv_data, 0, sizeof(IPMI_MAX_MSG_LENGTH));
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list