diff options
| author | Julia Lawall <julia@diku.dk> | 2011-08-09 11:10:56 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-17 13:55:53 -0400 |
| commit | 8282be4dd5ff3fef30271c61ee74db66524d8350 (patch) | |
| tree | 9c17b48951500277b8d82c98f8ddf7d1483bcf14 /drivers/hwmon | |
| parent | 55041e081ef433774279ecb6fc3fd30f741f5f37 (diff) | |
hwmon: (ibmaem) add missing kfree
commit 66a89b2164e2d30661edbd1953eacf0594d8203a upstream.
rs_resp is dynamically allocated in aem_read_sensor(), so it should be freed
before exiting in every case. This collects the kfree and the return at
the end of the function.
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon')
| -rw-r--r-- | drivers/hwmon/ibmaem.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c index 1a409c5bc9b..c316294c48b 100644 --- a/drivers/hwmon/ibmaem.c +++ b/drivers/hwmon/ibmaem.c | |||
| @@ -432,13 +432,15 @@ static int aem_read_sensor(struct aem_data *data, u8 elt, u8 reg, | |||
| 432 | aem_send_message(ipmi); | 432 | aem_send_message(ipmi); |
| 433 | 433 | ||
| 434 | res = wait_for_completion_timeout(&ipmi->read_complete, IPMI_TIMEOUT); | 434 | res = wait_for_completion_timeout(&ipmi->read_complete, IPMI_TIMEOUT); |
| 435 | if (!res) | 435 | if (!res) { |
| 436 | return -ETIMEDOUT; | 436 | res = -ETIMEDOUT; |
| 437 | goto out; | ||
| 438 | } | ||
| 437 | 439 | ||
| 438 | if (ipmi->rx_result || ipmi->rx_msg_len != rs_size || | 440 | if (ipmi->rx_result || ipmi->rx_msg_len != rs_size || |
| 439 | memcmp(&rs_resp->id, &system_x_id, sizeof(system_x_id))) { | 441 | memcmp(&rs_resp->id, &system_x_id, sizeof(system_x_id))) { |
| 440 | kfree(rs_resp); | 442 | res = -ENOENT; |
| 441 | return -ENOENT; | 443 | goto out; |
| 442 | } | 444 | } |
| 443 | 445 | ||
| 444 | switch (size) { | 446 | switch (size) { |
| @@ -463,8 +465,11 @@ static int aem_read_sensor(struct aem_data *data, u8 elt, u8 reg, | |||
| 463 | break; | 465 | break; |
| 464 | } | 466 | } |
| 465 | } | 467 | } |
| 468 | res = 0; | ||
| 466 | 469 | ||
| 467 | return 0; | 470 | out: |
| 471 | kfree(rs_resp); | ||
| 472 | return res; | ||
| 468 | } | 473 | } |
| 469 | 474 | ||
| 470 | /* Update AEM energy registers */ | 475 | /* Update AEM energy registers */ |
