From: Jeffy Chen <jeffy.chen@rock-chips.com>
To: linux-kernel@vger.kernel.org
Cc: dmitry.torokhov@gmail.com, heiko@sntech.de,
briannorris@chromium.org, rjw@rjwysocki.net,
dianders@chromium.org, tfiga@chromium.org, broonie@kernel.org,
seanpaul@chromium.org, Jeffy Chen <jeffy.chen@rock-chips.com>,
linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org,
Daniel Thompson <daniel.thompson@linaro.org>,
Thierry Reding <thierry.reding@gmail.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
dri-devel@lists.freedesktop.org,
Jingoo Han <jingoohan1@gmail.com>,
Lee Jones <lee.jones@linaro.org>
Subject: [RESEND PATCH v2 2/5] backlight: pwm_bl: Add device link for pwm_bl and pwm
Date: Mon, 16 Oct 2017 10:06:37 +0000 [thread overview]
Message-ID: <20171016100640.26575-3-jeffy.chen@rock-chips.com> (raw)
In-Reply-To: <20171016100640.26575-1-jeffy.chen@rock-chips.com>
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@rock-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
next prev parent reply other threads:[~2017-10-16 10:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-16 10:06 [RESEND PATCH v2 0/5] rockchip: kevin: Enable edp display Jeffy Chen
2017-10-16 10:06 ` Jeffy Chen [this message]
2017-10-16 23:57 ` [RESEND PATCH v2 2/5] backlight: pwm_bl: Add device link for pwm_bl and pwm Brian Norris
2017-10-17 8:13 ` jeffy
2017-10-17 16:51 ` Brian Norris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171016100640.26575-3-jeffy.chen@rock-chips.com \
--to=jeffy.chen@rock-chips.com \
--cc=b.zolnierkie@samsung.com \
--cc=briannorris@chromium.org \
--cc=broonie@kernel.org \
--cc=daniel.thompson@linaro.org \
--cc=dianders@chromium.org \
--cc=dmitry.torokhov@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=jingoohan1@gmail.com \
--cc=lee.jones@linaro.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=seanpaul@chromium.org \
--cc=tfiga@chromium.org \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).