aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/power_supply.c
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2016-05-24 13:34:51 -0500
committerGreg Kroah-Hartman <gregkh@google.com>2016-05-27 11:28:16 -0700
commit95073cc2e53c1352f2c244408d1bd005b07650fd (patch)
treefd54de6f0354c10278974f684bca42da78808009 /drivers/staging/greybus/power_supply.c
parentgreybus: fix pointless null check (diff)
downloadlinux-dev-95073cc2e53c1352f2c244408d1bd005b07650fd.tar.xz
linux-dev-95073cc2e53c1352f2c244408d1bd005b07650fd.zip
greybus: use PTR_ERR_OR_ZERO()
Coccinelle points out that the macro PTR_ERR_OR_ZERO() handles the frequent case of converting a pointer into either error code (if its value is an encoded error value) or 0 (otherwise). Switch some code in gb_power_supply_register() to use that macro. I have verified this is true of the kernel we're now working with (arche-6.0). Signed-off-by: Alex Elder <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/power_supply.c')
-rw-r--r--drivers/staging/greybus/power_supply.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/staging/greybus/power_supply.c b/drivers/staging/greybus/power_supply.c
index 9cae396c6115..8d6570d1bb61 100644
--- a/drivers/staging/greybus/power_supply.c
+++ b/drivers/staging/greybus/power_supply.c
@@ -547,10 +547,7 @@ static int gb_power_supply_register(struct gb_power_supply *gbpsy)
gbpsy->psy = power_supply_register(&connection->bundle->dev,
&gbpsy->desc, &cfg);
- if (IS_ERR(gbpsy->psy))
- return PTR_ERR(gbpsy->psy);
-
- return 0;
+ return PTR_ERR_OR_ZERO(gbpsy->psy);
}
#endif