diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2018-05-22 14:45:56 +0300 |
---|---|---|
committer | Jacek Anaszewski <jacek.anaszewski@gmail.com> | 2018-05-22 22:57:59 +0300 |
commit | 43926c2761bcf3a7a720f707510f9c00b2830bfa (patch) | |
tree | 38716c1fe05b383e35f859484377db6bd3d2cbfc /drivers/leds/leds-sc27xx-bltc.c | |
parent | e081c49e30ec2d42ac60e291dff24808fb81a99f (diff) | |
download | linux-43926c2761bcf3a7a720f707510f9c00b2830bfa.tar.xz |
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: e081c49e30ec ("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>
Diffstat (limited to 'drivers/leds/leds-sc27xx-bltc.c')
-rw-r--r-- | drivers/leds/leds-sc27xx-bltc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/leds/leds-sc27xx-bltc.c b/drivers/leds/leds-sc27xx-bltc.c index 54a90c8781b6..9d9b7aab843f 100644 --- a/drivers/leds/leds-sc27xx-bltc.c +++ b/drivers/leds/leds-sc27xx-bltc.c @@ -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; } |