[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <be06426b-74cf-832a-4ef3-2e37cf3013e9@users.sourceforge.net>
Date: Sat, 23 Jul 2016 15:02:23 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linux-pm@...r.kernel.org, David Woodhouse <dwmw2@...radead.org>,
Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
Sebastian Reichel <sre@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH] power: generic-adc-battery: Delete unnecessary checks before
the function call "iio_channel_release"
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 23 Jul 2016 14:50:47 +0200
The iio_channel_release() function tests whether its argument is NULL
and then returns immediately. Thus the test around the calls is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/power/generic-adc-battery.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/power/generic-adc-battery.c b/drivers/power/generic-adc-battery.c
index edb36bf..8f7f24c 100644
--- a/drivers/power/generic-adc-battery.c
+++ b/drivers/power/generic-adc-battery.c
@@ -350,10 +350,8 @@ err_gpio:
gpio_req_fail:
power_supply_unregister(adc_bat->psy);
err_reg_fail:
- for (chan = 0; chan < ARRAY_SIZE(gab_chan_name); chan++) {
- if (adc_bat->channel[chan])
- iio_channel_release(adc_bat->channel[chan]);
- }
+ for (chan = 0; chan < ARRAY_SIZE(gab_chan_name); chan++)
+ iio_channel_release(adc_bat->channel[chan]);
second_mem_fail:
kfree(psy_desc->properties);
first_mem_fail:
@@ -373,11 +371,8 @@ static int gab_remove(struct platform_device *pdev)
gpio_free(pdata->gpio_charge_finished);
}
- for (chan = 0; chan < ARRAY_SIZE(gab_chan_name); chan++) {
- if (adc_bat->channel[chan])
- iio_channel_release(adc_bat->channel[chan]);
- }
-
+ for (chan = 0; chan < ARRAY_SIZE(gab_chan_name); chan++)
+ iio_channel_release(adc_bat->channel[chan]);
kfree(adc_bat->psy_desc.properties);
cancel_delayed_work(&adc_bat->bat_work);
return 0;
--
2.9.2
Powered by blists - more mailing lists