leds: tlc591xx: merge conditional tests
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sat, 15 Jul 2017 09:58:18 +0000 (11:58 +0200)
committerJacek Anaszewski <jacek.anaszewski@gmail.com>
Sun, 16 Jul 2017 16:44:29 +0000 (18:44 +0200)
Merge conditionals that have the same then branch, to prepare for extending
that branch with of_node_put.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
drivers/leds/leds-tlc591xx.c

index 3045316..fcc87ee 100644 (file)
@@ -232,9 +232,8 @@ tlc591xx_probe(struct i2c_client *client,
                err = of_property_read_u32(child, "reg", &reg);
                if (err)
                        return err;
-               if (reg < 0 || reg >= tlc591xx->max_leds)
-                       return -EINVAL;
-               if (priv->leds[reg].active)
+               if (reg < 0 || reg >= tlc591xx->max_leds ||
+                   priv->leds[reg].active)
                        return -EINVAL;
                priv->leds[reg].active = true;
                priv->leds[reg].ldev.name =