[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171016100640.26575-3-jeffy.chen@rock-chips.com>
Date: Mon, 16 Oct 2017 18:06:37 +0800
From: Jeffy Chen <jeffy.chen@...k-chips.com>
To: linux-kernel@...r.kernel.org
Cc: dmitry.torokhov@...il.com, heiko@...ech.de,
briannorris@...omium.org, rjw@...ysocki.net, dianders@...omium.org,
tfiga@...omium.org, broonie@...nel.org, seanpaul@...omium.org,
Jeffy Chen <jeffy.chen@...k-chips.com>,
linux-pwm@...r.kernel.org, linux-fbdev@...r.kernel.org,
Daniel Thompson <daniel.thompson@...aro.org>,
Thierry Reding <thierry.reding@...il.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
dri-devel@...ts.freedesktop.org, Jingoo Han <jingoohan1@...il.com>,
Lee Jones <lee.jones@...aro.org>
Subject: [RESEND PATCH v2 2/5] backlight: pwm_bl: Add device link for pwm_bl and pwm
When the pwm driver is unbound, the pwm_bl driver would still hold a
reference to that pwm, and crash the kernel later(if someone trying
to access that invalid pwm).
Add a device link to avoid this.
Signed-off-by: Jeffy Chen <jeffy.chen@...k-chips.com>
---
Changes in v2: None
drivers/video/backlight/pwm_bl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 9bd17682655a..a76f147a26e7 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -328,6 +328,8 @@ static int pwm_backlight_probe(struct platform_device *pdev)
goto err_alloc;
}
+ device_link_add(&pdev->dev, pb->pwm->chip->dev, DL_FLAG_AUTOREMOVE);
+
dev_dbg(&pdev->dev, "got pwm for backlight\n");
/*
--
2.11.0
Powered by blists - more mailing lists