All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/exynos: Don't fail if no TE-gpio is defined for DSI driver
       [not found] <CGME20220121100046eucas1p264ec703358da48f3cddec028425ba981@eucas1p2.samsung.com>
@ 2022-01-21 10:00   ` Marek Szyprowski
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Szyprowski @ 2022-01-21 10:00 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: Marek Szyprowski, Seung-Woo Kim, Inki Dae, Maíra Canal,
	Krzysztof Kozlowski

TE-gpio is optional and if it is not found then gpiod_get_optional()
returns NULL. In such case the code will continue and try to convert NULL
gpiod to irq what in turn fails. The failure is then propagated and driver
is not registered.

Fix this by returning early from exynos_dsi_register_te_irq() if no
TE-gpio is found.

Fixes: ee6c8b5afa62 ("drm/exynos: Replace legacy gpio interface for gpiod interface")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 32a36572b894..14ebbb124852 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1335,7 +1335,9 @@ static int exynos_dsi_register_te_irq(struct exynos_dsi *dsi,
 	int te_gpio_irq;
 
 	dsi->te_gpio = devm_gpiod_get_optional(dsi->dev, "te", GPIOD_IN);
-	if (IS_ERR(dsi->te_gpio)) {
+	if (!dsi->te_gpio) {
+		return 0;
+	} else if (IS_ERR(dsi->te_gpio)) {
 		dev_err(dsi->dev, "gpio request failed with %ld\n",
 				PTR_ERR(dsi->te_gpio));
 		return PTR_ERR(dsi->te_gpio);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] drm/exynos: Don't fail if no TE-gpio is defined for DSI driver
@ 2022-01-21 10:00   ` Marek Szyprowski
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Szyprowski @ 2022-01-21 10:00 UTC (permalink / raw)
  To: dri-devel, linux-samsung-soc
  Cc: Maíra Canal, Krzysztof Kozlowski, Seung-Woo Kim, Marek Szyprowski

TE-gpio is optional and if it is not found then gpiod_get_optional()
returns NULL. In such case the code will continue and try to convert NULL
gpiod to irq what in turn fails. The failure is then propagated and driver
is not registered.

Fix this by returning early from exynos_dsi_register_te_irq() if no
TE-gpio is found.

Fixes: ee6c8b5afa62 ("drm/exynos: Replace legacy gpio interface for gpiod interface")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 32a36572b894..14ebbb124852 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1335,7 +1335,9 @@ static int exynos_dsi_register_te_irq(struct exynos_dsi *dsi,
 	int te_gpio_irq;
 
 	dsi->te_gpio = devm_gpiod_get_optional(dsi->dev, "te", GPIOD_IN);
-	if (IS_ERR(dsi->te_gpio)) {
+	if (!dsi->te_gpio) {
+		return 0;
+	} else if (IS_ERR(dsi->te_gpio)) {
 		dev_err(dsi->dev, "gpio request failed with %ld\n",
 				PTR_ERR(dsi->te_gpio));
 		return PTR_ERR(dsi->te_gpio);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/exynos: Don't fail if no TE-gpio is defined for DSI driver
  2022-01-21 10:00   ` Marek Szyprowski
@ 2022-01-24  5:22     ` Inki Dae
  -1 siblings, 0 replies; 4+ messages in thread
From: Inki Dae @ 2022-01-24  5:22 UTC (permalink / raw)
  To: Marek Szyprowski, dri-devel, linux-samsung-soc
  Cc: Seung-Woo Kim, Maíra Canal, Krzysztof Kozlowski

Hi Marek,

Thanks for fixing it.
Inki Dae.

22. 1. 21. 19:00에 Marek Szyprowski 이(가) 쓴 글:
> TE-gpio is optional and if it is not found then gpiod_get_optional()
> returns NULL. In such case the code will continue and try to convert NULL
> gpiod to irq what in turn fails. The failure is then propagated and driver
> is not registered.
> 
> Fix this by returning early from exynos_dsi_register_te_irq() if no
> TE-gpio is found.
> 
> Fixes: ee6c8b5afa62 ("drm/exynos: Replace legacy gpio interface for gpiod interface")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> ---
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> index 32a36572b894..14ebbb124852 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> @@ -1335,7 +1335,9 @@ static int exynos_dsi_register_te_irq(struct exynos_dsi *dsi,
>  	int te_gpio_irq;
>  
>  	dsi->te_gpio = devm_gpiod_get_optional(dsi->dev, "te", GPIOD_IN);
> -	if (IS_ERR(dsi->te_gpio)) {
> +	if (!dsi->te_gpio) {
> +		return 0;
> +	} else if (IS_ERR(dsi->te_gpio)) {
>  		dev_err(dsi->dev, "gpio request failed with %ld\n",
>  				PTR_ERR(dsi->te_gpio));
>  		return PTR_ERR(dsi->te_gpio);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/exynos: Don't fail if no TE-gpio is defined for DSI driver
@ 2022-01-24  5:22     ` Inki Dae
  0 siblings, 0 replies; 4+ messages in thread
From: Inki Dae @ 2022-01-24  5:22 UTC (permalink / raw)
  To: Marek Szyprowski, dri-devel, linux-samsung-soc
  Cc: Maíra Canal, Seung-Woo Kim, Krzysztof Kozlowski

Hi Marek,

Thanks for fixing it.
Inki Dae.

22. 1. 21. 19:00에 Marek Szyprowski 이(가) 쓴 글:
> TE-gpio is optional and if it is not found then gpiod_get_optional()
> returns NULL. In such case the code will continue and try to convert NULL
> gpiod to irq what in turn fails. The failure is then propagated and driver
> is not registered.
> 
> Fix this by returning early from exynos_dsi_register_te_irq() if no
> TE-gpio is found.
> 
> Fixes: ee6c8b5afa62 ("drm/exynos: Replace legacy gpio interface for gpiod interface")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> ---
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> index 32a36572b894..14ebbb124852 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> @@ -1335,7 +1335,9 @@ static int exynos_dsi_register_te_irq(struct exynos_dsi *dsi,
>  	int te_gpio_irq;
>  
>  	dsi->te_gpio = devm_gpiod_get_optional(dsi->dev, "te", GPIOD_IN);
> -	if (IS_ERR(dsi->te_gpio)) {
> +	if (!dsi->te_gpio) {
> +		return 0;
> +	} else if (IS_ERR(dsi->te_gpio)) {
>  		dev_err(dsi->dev, "gpio request failed with %ld\n",
>  				PTR_ERR(dsi->te_gpio));
>  		return PTR_ERR(dsi->te_gpio);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-24  5:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20220121100046eucas1p264ec703358da48f3cddec028425ba981@eucas1p2.samsung.com>
2022-01-21 10:00 ` [PATCH] drm/exynos: Don't fail if no TE-gpio is defined for DSI driver Marek Szyprowski
2022-01-21 10:00   ` Marek Szyprowski
2022-01-24  5:22   ` Inki Dae
2022-01-24  5:22     ` Inki Dae

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.