leds: lp3952: Use 'if (ret)' pattern
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 23 Mar 2017 19:17:49 +0000 (21:17 +0200)
committerJacek Anaszewski <jacek.anaszewski@gmail.com>
Thu, 23 Mar 2017 19:33:59 +0000 (20:33 +0100)
Instead of unusual "if (!ret)" use "if (ret)" in lp3952_get_label().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
drivers/leds/leds-lp3952.c

index 5184436b890543609c27b77f75b74cd9376bd89c..847f7f282126eeef4608ba5eb87620fe084051de 100644 (file)
@@ -102,10 +102,11 @@ static int lp3952_get_label(struct device *dev, const char *label, char *dest)
        const char *str;
 
        ret = device_property_read_string(dev, label, &str);
-       if (!ret)
-               strncpy(dest, str, LP3952_LABEL_MAX_LEN);
+       if (ret)
+               return ret;
 
-       return ret;
+       strncpy(dest, str, LP3952_LABEL_MAX_LEN);
+       return 0;
 }
 
 static int lp3952_register_led_classdev(struct lp3952_led_array *priv)