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: e081c49e30 ("leds: Add Spreadtrum SC27xx breathing light controller driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
This commit is contained in:
Wei Yongjun 2018-05-22 11:45:56 +00:00 committed by Jacek Anaszewski
parent e081c49e30
commit 43926c2761
1 changed files with 2 additions and 2 deletions

View File

@ -176,8 +176,8 @@ static int sc27xx_led_probe(struct platform_device *pdev)
mutex_init(&priv->lock);
priv->base = base;
priv->regmap = dev_get_regmap(dev->parent, NULL);
if (IS_ERR(priv->regmap)) {
err = PTR_ERR(priv->regmap);
if (!priv->regmap) {
err = -ENODEV;
dev_err(dev, "failed to get regmap: %d\n", err);
return err;
}