Skip to content

Commit 36b0fef

Browse files
Qiushi Wugroeck
authored andcommitted
hwmon: (ibmaem) match return type of wait_for_completion_timeout
Return type of wait_for_completion_timeout is unsigned long not int. Check its return value inline instead of introducing a throw-away variable. Reviewed-by: Mimi Zohar <[email protected]> Signed-off-by: Qiushi Wu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 6e25329 commit 36b0fef

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

drivers/hwmon/ibmaem.c

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ static void aem_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data)
349349
static int aem_read_sensor(struct aem_data *data, u8 elt, u8 reg,
350350
void *buf, size_t size)
351351
{
352-
int rs_size, res;
352+
int rs_size;
353353
struct aem_read_sensor_req rs_req;
354354
/* Use preallocated rx buffer */
355355
struct aem_read_sensor_resp *rs_resp = data->rs_resp;
@@ -383,17 +383,12 @@ static int aem_read_sensor(struct aem_data *data, u8 elt, u8 reg,
383383

384384
aem_send_message(ipmi);
385385

386-
res = wait_for_completion_timeout(&ipmi->read_complete, IPMI_TIMEOUT);
387-
if (!res) {
388-
res = -ETIMEDOUT;
389-
goto out;
390-
}
386+
if (!wait_for_completion_timeout(&ipmi->read_complete, IPMI_TIMEOUT))
387+
return -ETIMEDOUT;
391388

392389
if (ipmi->rx_result || ipmi->rx_msg_len != rs_size ||
393-
memcmp(&rs_resp->id, &system_x_id, sizeof(system_x_id))) {
394-
res = -ENOENT;
395-
goto out;
396-
}
390+
memcmp(&rs_resp->id, &system_x_id, sizeof(system_x_id)))
391+
return -ENOENT;
397392

398393
switch (size) {
399394
case 1: {
@@ -417,10 +412,8 @@ static int aem_read_sensor(struct aem_data *data, u8 elt, u8 reg,
417412
break;
418413
}
419414
}
420-
res = 0;
421415

422-
out:
423-
return res;
416+
return 0;
424417
}
425418

426419
/* Update AEM energy registers */
@@ -491,7 +484,6 @@ static void aem_delete(struct aem_data *data)
491484
/* Retrieve version and module handle for an AEM1 instance */
492485
static int aem_find_aem1_count(struct aem_ipmi_data *data)
493486
{
494-
int res;
495487
struct aem_find_firmware_req ff_req;
496488
struct aem_find_firmware_resp ff_resp;
497489

@@ -508,8 +500,7 @@ static int aem_find_aem1_count(struct aem_ipmi_data *data)
508500

509501
aem_send_message(data);
510502

511-
res = wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT);
512-
if (!res)
503+
if (!wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT))
513504
return -ETIMEDOUT;
514505

515506
if (data->rx_result || data->rx_msg_len != sizeof(ff_resp) ||
@@ -632,7 +623,6 @@ static int aem_find_aem2(struct aem_ipmi_data *data,
632623
struct aem_find_instance_resp *fi_resp,
633624
int instance_num)
634625
{
635-
int res;
636626
struct aem_find_instance_req fi_req;
637627

638628
fi_req.id = system_x_id;
@@ -648,8 +638,7 @@ static int aem_find_aem2(struct aem_ipmi_data *data,
648638

649639
aem_send_message(data);
650640

651-
res = wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT);
652-
if (!res)
641+
if (!wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT))
653642
return -ETIMEDOUT;
654643

655644
if (data->rx_result || data->rx_msg_len != sizeof(*fi_resp) ||

0 commit comments

Comments
 (0)