Merge branch 'for-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/jlawall...
[linux-2.6-microblaze.git] / drivers / leds / leds-tlc591xx.c
index 5b9dfdf..cb7bd13 100644 (file)
@@ -148,16 +148,20 @@ static int
 tlc591xx_probe(struct i2c_client *client,
               const struct i2c_device_id *id)
 {
-       struct device_node *np = dev_of_node(&client->dev), *child;
+       struct device_node *np, *child;
        struct device *dev = &client->dev;
        const struct tlc591xx *tlc591xx;
        struct tlc591xx_priv *priv;
        int err, count, reg;
 
-       tlc591xx = device_get_match_data(dev);
+       np = dev_of_node(dev);
        if (!np)
                return -ENODEV;
 
+       tlc591xx = device_get_match_data(dev);
+       if (!tlc591xx)
+               return -ENODEV;
+
        count = of_get_available_child_count(np);
        if (!count || count > tlc591xx->max_leds)
                return -EINVAL;