Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <zohar@linux.ibm.com>
Signed-off-by: Qiushi Wu <qiushi@linux.ibm.com>
Link: https://lore.kernel.org/r/20250613182413.1426367-1-qiushi@linux.ibm.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Qiushi Wu and committed by
Guenter Roeck
36b0fef0 6e253295

+8 -19
+8 -19
drivers/hwmon/ibmaem.c
··· 349 349 static int aem_read_sensor(struct aem_data *data, u8 elt, u8 reg, 350 350 void *buf, size_t size) 351 351 { 352 - int rs_size, res; 352 + int rs_size; 353 353 struct aem_read_sensor_req rs_req; 354 354 /* Use preallocated rx buffer */ 355 355 struct aem_read_sensor_resp *rs_resp = data->rs_resp; ··· 383 383 384 384 aem_send_message(ipmi); 385 385 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; 391 388 392 389 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; 397 392 398 393 switch (size) { 399 394 case 1: { ··· 412 417 break; 413 418 } 414 419 } 415 - res = 0; 416 420 417 - out: 418 - return res; 421 + return 0; 419 422 } 420 423 421 424 /* Update AEM energy registers */ ··· 484 491 /* Retrieve version and module handle for an AEM1 instance */ 485 492 static int aem_find_aem1_count(struct aem_ipmi_data *data) 486 493 { 487 - int res; 488 494 struct aem_find_firmware_req ff_req; 489 495 struct aem_find_firmware_resp ff_resp; 490 496 ··· 500 508 501 509 aem_send_message(data); 502 510 503 - res = wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT); 504 - if (!res) 511 + if (!wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT)) 505 512 return -ETIMEDOUT; 506 513 507 514 if (data->rx_result || data->rx_msg_len != sizeof(ff_resp) || ··· 623 632 struct aem_find_instance_resp *fi_resp, 624 633 int instance_num) 625 634 { 626 - int res; 627 635 struct aem_find_instance_req fi_req; 628 636 629 637 fi_req.id = system_x_id; ··· 638 648 639 649 aem_send_message(data); 640 650 641 - res = wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT); 642 - if (!res) 651 + if (!wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT)) 643 652 return -ETIMEDOUT; 644 653 645 654 if (data->rx_result || data->rx_msg_len != sizeof(*fi_resp) ||