backlight: sky81452-backlight: Fix refcount imbalance on error
authordinghao.liu@zju.edu.cn <dinghao.liu@zju.edu.cn>
Thu, 20 Aug 2020 06:38:17 +0000 (14:38 +0800)
committerLee Jones <lee.jones@linaro.org>
Fri, 28 Aug 2020 09:25:54 +0000 (10:25 +0100)
When of_property_read_u32_array() returns an error code, a
pairing refcount decrement is needed to keep np's refcount
balanced.

Fixes: f705806c9f355 ("backlight: Add support Skyworks SKY81452 backlight driver")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/video/backlight/sky81452-backlight.c

index 0ce1815..8268ac4 100644 (file)
@@ -217,6 +217,7 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt(
                                        num_entry);
                if (ret < 0) {
                        dev_err(dev, "led-sources node is invalid.\n");
+                       of_node_put(np);
                        return ERR_PTR(-EINVAL);
                }