* [PATCH] drm/panel: ili9341: fix optional regulator handling
@ 2022-03-17 22:55 Daniel Mack
2022-03-18 10:09 ` Daniel Vetter
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Mack @ 2022-03-17 22:55 UTC (permalink / raw)
To: dillon.minfei, thierry.reding, sam; +Cc: airlied, Daniel Mack, dri-devel
If the optional regulator lookup fails, reset the pointer to NULL.
Other functions such as mipi_dbi_poweron_reset_conditional() only do
a NULL pointer check and will otherwise dereference the error pointer.
Fixes: 5a04227326b04c15 ("drm/panel: Add ilitek ili9341 panel driver")
Signed-off-by: Daniel Mack <daniel@zonque.org>
---
drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
index 2c3378a259b1..e1542451ef9d 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
@@ -612,8 +612,10 @@ static int ili9341_dbi_probe(struct spi_device *spi, struct gpio_desc *dc,
int ret;
vcc = devm_regulator_get_optional(dev, "vcc");
- if (IS_ERR(vcc))
+ if (IS_ERR(vcc)) {
dev_err(dev, "get optional vcc failed\n");
+ vcc = NULL;
+ }
dbidev = devm_drm_dev_alloc(dev, &ili9341_dbi_driver,
struct mipi_dbi_dev, drm);
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/panel: ili9341: fix optional regulator handling
2022-03-17 22:55 [PATCH] drm/panel: ili9341: fix optional regulator handling Daniel Mack
@ 2022-03-18 10:09 ` Daniel Vetter
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2022-03-18 10:09 UTC (permalink / raw)
To: Daniel Mack; +Cc: airlied, sam, thierry.reding, dillon.minfei, dri-devel
On Thu, Mar 17, 2022 at 11:55:37PM +0100, Daniel Mack wrote:
> If the optional regulator lookup fails, reset the pointer to NULL.
> Other functions such as mipi_dbi_poweron_reset_conditional() only do
> a NULL pointer check and will otherwise dereference the error pointer.
>
> Fixes: 5a04227326b04c15 ("drm/panel: Add ilitek ili9341 panel driver")
> Signed-off-by: Daniel Mack <daniel@zonque.org>
Merged into drm-misc-fixes and added cc: stable.
-Daniel
> ---
> drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
> index 2c3378a259b1..e1542451ef9d 100644
> --- a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
> +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
> @@ -612,8 +612,10 @@ static int ili9341_dbi_probe(struct spi_device *spi, struct gpio_desc *dc,
> int ret;
>
> vcc = devm_regulator_get_optional(dev, "vcc");
> - if (IS_ERR(vcc))
> + if (IS_ERR(vcc)) {
> dev_err(dev, "get optional vcc failed\n");
> + vcc = NULL;
> + }
>
> dbidev = devm_drm_dev_alloc(dev, &ili9341_dbi_driver,
> struct mipi_dbi_dev, drm);
> --
> 2.35.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-18 10:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-17 22:55 [PATCH] drm/panel: ili9341: fix optional regulator handling Daniel Mack
2022-03-18 10:09 ` Daniel Vetter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.