aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2013-11-07 03:06:17 -0500
committerAnton Vorontsov <anton@enomsg.org>2013-11-13 01:36:34 -0500
commitc8024234c20eaf7b163cc4dbd963cb9cd03a4ff1 (patch)
treec4d8e67a8da0551632a471c0f6b9bc4e4ac0d89e /drivers/power
parentec0b380245d7b7d4d8e4201facca780a14352cda (diff)
pm2301-charger: Remove unneeded NULL checks
If "pm2" were NULL we would oops printing the error message. Fortunately, that's not possible so I have removed the NULL checks. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/pm2301_charger.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/drivers/power/pm2301_charger.c b/drivers/power/pm2301_charger.c
index b733c692a17f..62c15af58c9a 100644
--- a/drivers/power/pm2301_charger.c
+++ b/drivers/power/pm2301_charger.c
@@ -957,37 +957,24 @@ static int pm2xxx_runtime_suspend(struct device *dev)
957{ 957{
958 struct i2c_client *pm2xxx_i2c_client = to_i2c_client(dev); 958 struct i2c_client *pm2xxx_i2c_client = to_i2c_client(dev);
959 struct pm2xxx_charger *pm2; 959 struct pm2xxx_charger *pm2;
960 int ret = 0;
961 960
962 pm2 = (struct pm2xxx_charger *)i2c_get_clientdata(pm2xxx_i2c_client); 961 pm2 = (struct pm2xxx_charger *)i2c_get_clientdata(pm2xxx_i2c_client);
963 if (!pm2) {
964 dev_err(pm2->dev, "no pm2xxx_charger data supplied\n");
965 ret = -EINVAL;
966 return ret;
967 }
968
969 clear_lpn_pin(pm2); 962 clear_lpn_pin(pm2);
970 963
971 return ret; 964 return 0;
972} 965}
973 966
974static int pm2xxx_runtime_resume(struct device *dev) 967static int pm2xxx_runtime_resume(struct device *dev)
975{ 968{
976 struct i2c_client *pm2xxx_i2c_client = to_i2c_client(dev); 969 struct i2c_client *pm2xxx_i2c_client = to_i2c_client(dev);
977 struct pm2xxx_charger *pm2; 970 struct pm2xxx_charger *pm2;
978 int ret = 0;
979 971
980 pm2 = (struct pm2xxx_charger *)i2c_get_clientdata(pm2xxx_i2c_client); 972 pm2 = (struct pm2xxx_charger *)i2c_get_clientdata(pm2xxx_i2c_client);
981 if (!pm2) {
982 dev_err(pm2->dev, "no pm2xxx_charger data supplied\n");
983 ret = -EINVAL;
984 return ret;
985 }
986 973
987 if (gpio_is_valid(pm2->lpn_pin) && gpio_get_value(pm2->lpn_pin) == 0) 974 if (gpio_is_valid(pm2->lpn_pin) && gpio_get_value(pm2->lpn_pin) == 0)
988 set_lpn_pin(pm2); 975 set_lpn_pin(pm2);
989 976
990 return ret; 977 return 0;
991} 978}
992 979
993#endif 980#endif