From: Andrew Jeffery Date: Tue, 21 Sep 2021 04:39:36 +0000 (+0930) Subject: leds: pca955x: Allow zero LEDs to be specified X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=e26557a0aa68acfb705b51947b7c756401a1ab71;p=linux.git leds: pca955x: Allow zero LEDs to be specified It's valid to use the PCA955x devices just for GPIOs and not for LEDs. In this case, as PCA955X_TYPE_GPIO is now equivalent to PCA955X_TYPE_NONE, remove the test for whether we have any child nodes specified in the devicetree. A consequence of this is it's now possible to bind the driver to a PCA955x device when dynamically instantiated through the I2C subsystem's `new_device` interface. Signed-off-by: Andrew Jeffery Reviewed-by: Andy Shevchenko Reviewed-by: Linus Walleij Reviewed-by: Joel Stanley Reviewed-by: Cédric Le Goater Signed-off-by: Pavel Machek --- diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c index 77c0f461ab957..81aaf21212d7d 100644 --- a/drivers/leds/leds-pca955x.c +++ b/drivers/leds/leds-pca955x.c @@ -429,7 +429,7 @@ pca955x_get_pdata(struct i2c_client *client, struct pca955x_chipdef *chip) int count; count = device_get_child_node_count(&client->dev); - if (!count || count > chip->bits) + if (count > chip->bits) return ERR_PTR(-ENODEV); pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);