Skip to content

Commit 43926c2

Browse files
Wei Yongjunjacek-anaszewski
authored andcommitted
leds: sc27xx: Fix return value check in sc27xx_led_probe()
In case of error, the function dev_get_regmap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: e081c49 ("leds: Add Spreadtrum SC27xx breathing light controller driver") Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Jacek Anaszewski <[email protected]>
1 parent e081c49 commit 43926c2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/leds/leds-sc27xx-bltc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ static int sc27xx_led_probe(struct platform_device *pdev)
176176
mutex_init(&priv->lock);
177177
priv->base = base;
178178
priv->regmap = dev_get_regmap(dev->parent, NULL);
179-
if (IS_ERR(priv->regmap)) {
180-
err = PTR_ERR(priv->regmap);
179+
if (!priv->regmap) {
180+
err = -ENODEV;
181181
dev_err(dev, "failed to get regmap: %d\n", err);
182182
return err;
183183
}

0 commit comments

Comments
 (0)