From: David Heidelberg <[email protected]>

wled_probe() doesn't set the driver data for the platform device.
As a result, dev_get_drvdata() in wled_remove() will return NULL,
leading to a NULL pointer dereference afterward.

Set the platform device driver data in wled_probe().

Cc: [email protected]
Fixes: feeab87b3072 ("backlight: qcom-wled: Add support for short circuit 
handling")
Signed-off-by: David Heidelberg <[email protected]>
---
 drivers/video/backlight/qcom-wled.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/backlight/qcom-wled.c 
b/drivers/video/backlight/qcom-wled.c
index 650dd95f06ef5..a76158a298335 100644
--- a/drivers/video/backlight/qcom-wled.c
+++ b/drivers/video/backlight/qcom-wled.c
@@ -1747,16 +1747,17 @@ static int wled_probe(struct platform_device *pdev)
 
        memset(&props, 0, sizeof(struct backlight_properties));
        props.type = BACKLIGHT_RAW;
        props.brightness = val;
        props.max_brightness = wled->max_brightness;
        bl = devm_backlight_device_register(&pdev->dev, wled->name,
                                            &pdev->dev, wled,
                                            &wled_ops, &props);
+       platform_set_drvdata(pdev, bl);
        return PTR_ERR_OR_ZERO(bl);
 };
 
 static void wled_remove(struct platform_device *pdev)
 {
        struct wled *wled = platform_get_drvdata(pdev);
 
        mutex_destroy(&wled->lock);

-- 
2.55.0


Reply via email to