diff mbox

power_supply: wm97xx_battery: remove redundant 2nd null check on pdata

Message ID 20161229152312.20537-1-colin.king@canonical.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Colin King Dec. 29, 2016, 3:23 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

pdata is being null checked twice, the 2nd check is redundant code
and can be removed.

Fixes CoverityScan CID 1392340 "Logically dead code"

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/power/supply/wm97xx_battery.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Sebastian Reichel Jan. 4, 2017, 9:21 p.m. UTC | #1
Hi Colin,

On Thu, Dec 29, 2016 at 03:23:12PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> pdata is being null checked twice, the 2nd check is redundant code
> and can be removed.
> 
> Fixes CoverityScan CID 1392340 "Logically dead code"
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Thanks for your patch. I have queued it into power-supply's
for-next branch:

https://git.kernel.org/cgit/linux/kernel/git/sre/linux-power-supply.git/log/?h=for-next

-- Sebastian
diff mbox

Patch

diff --git a/drivers/power/supply/wm97xx_battery.c b/drivers/power/supply/wm97xx_battery.c
index e3edb31..bd4f666 100644
--- a/drivers/power/supply/wm97xx_battery.c
+++ b/drivers/power/supply/wm97xx_battery.c
@@ -175,11 +175,6 @@  static int wm97xx_bat_probe(struct platform_device *dev)
 	if (dev->id != -1)
 		return -EINVAL;
 
-	if (!pdata) {
-		dev_err(&dev->dev, "No platform_data supplied\n");
-		return -EINVAL;
-	}
-
 	if (gpio_is_valid(pdata->charge_gpio)) {
 		ret = gpio_request(pdata->charge_gpio, "BATT CHRG");
 		if (ret)