From: David Heidelberg <[email protected]>

wled_probe() doesn't set the driver data for the platform device.
As a result, platform_get_drvdata() in wled_remove() will return NULL,
and the first dereference of it crashes on unbind.

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..2281007bdd459 100644
--- a/drivers/video/backlight/qcom-wled.c
+++ b/drivers/video/backlight/qcom-wled.c
@@ -1675,16 +1675,17 @@ static int wled_probe(struct platform_device *pdev)
        }
 
        wled = devm_kzalloc(&pdev->dev, sizeof(*wled), GFP_KERNEL);
        if (!wled)
                return -ENOMEM;
 
        wled->regmap = regmap;
        wled->dev = &pdev->dev;
+       platform_set_drvdata(pdev, wled);
 
        wled->version = (uintptr_t)of_device_get_match_data(&pdev->dev);
        if (!wled->version) {
                dev_err(&pdev->dev, "Unknown device version\n");
                return -ENODEV;
        }
 
        mutex_init(&wled->lock);

-- 
2.55.0



Reply via email to