Commit e0e02160 authored by Sachin Kamat's avatar Sachin Kamat Committed by Bryan Wu

leds-lm3530: Fix smatch warnings

Fixes the following smatch warnings:
drivers/leds/leds-lm3530.c:361 lm3530_mode_set() info:
why not propagate 'mode' from lm3530_get_mode_from_str() instead of -22?
drivers/leds/leds-lm3530.c:432 lm3530_probe() info:
why not propagate 'err' from lm3530_init_registers() instead of -19?
drivers/leds/leds-lm3530.c:438 lm3530_probe() info:
why not propagate 'err' from led_classdev_register() instead of -19?
Reported-by: default avatarFengguang Wu <fengguang.wu@intel.com>
Cc: Shreshtha Kumar SAHU <shreshthakumar.sahu@stericsson.com>
Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: default avatarBryan Wu <bryan.wu@canonical.com>
parent a47df97c
...@@ -150,7 +150,7 @@ static int lm3530_get_mode_from_str(const char *str) ...@@ -150,7 +150,7 @@ static int lm3530_get_mode_from_str(const char *str)
if (sysfs_streq(str, mode_map[i].mode)) if (sysfs_streq(str, mode_map[i].mode))
return mode_map[i].mode_val; return mode_map[i].mode_val;
return -1; return -EINVAL;
} }
static void lm3530_als_configure(struct lm3530_platform_data *pdata, static void lm3530_als_configure(struct lm3530_platform_data *pdata,
...@@ -358,7 +358,7 @@ static ssize_t lm3530_mode_set(struct device *dev, struct device_attribute ...@@ -358,7 +358,7 @@ static ssize_t lm3530_mode_set(struct device *dev, struct device_attribute
mode = lm3530_get_mode_from_str(buf); mode = lm3530_get_mode_from_str(buf);
if (mode < 0) { if (mode < 0) {
dev_err(dev, "Invalid mode\n"); dev_err(dev, "Invalid mode\n");
return -EINVAL; return mode;
} }
drvdata->mode = mode; drvdata->mode = mode;
...@@ -429,13 +429,13 @@ static int __devinit lm3530_probe(struct i2c_client *client, ...@@ -429,13 +429,13 @@ static int __devinit lm3530_probe(struct i2c_client *client,
if (err < 0) { if (err < 0) {
dev_err(&client->dev, dev_err(&client->dev,
"Register Init failed: %d\n", err); "Register Init failed: %d\n", err);
return -ENODEV; return err;
} }
} }
err = led_classdev_register(&client->dev, &drvdata->led_dev); err = led_classdev_register(&client->dev, &drvdata->led_dev);
if (err < 0) { if (err < 0) {
dev_err(&client->dev, "Register led class failed: %d\n", err); dev_err(&client->dev, "Register led class failed: %d\n", err);
return -ENODEV; return err;
} }
err = device_create_file(drvdata->led_dev.dev, &dev_attr_mode); err = device_create_file(drvdata->led_dev.dev, &dev_attr_mode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment