* [PATCH v2 1/2] drm/kmb: Fix an error handling path
@ 2021-05-27 6:10 Christophe JAILLET
2021-05-27 6:10 ` [PATCH v2 2/2] drm/kmb: Do not report 0 (success) in case of error Christophe JAILLET
0 siblings, 1 reply; 3+ messages in thread
From: Christophe JAILLET @ 2021-05-27 6:10 UTC (permalink / raw)
To: anitha.chrisanthus, edmund.j.dea, airlied, daniel, sam
Cc: Christophe JAILLET, kernel-janitors, linux-kernel, dri-devel
If 'platform_get_irq()' fails, it is spurious to call
'of_reserved_mem_device_release()' in the error handling path, because
'of_reserved_mem_device_init() has not been called yet.
Moreover, a previous 'kmb_initialize_clocks()' is unbalanced by a
corresponding 'kmb_display_clk_disable()' call, has already done in the
remove function.
It is likely that 'kmb_display_clk_disable()' is expected in the error
handling path, instead of 'of_reserved_mem_device_release()'.
Also, it is spurious to return directly if 'of_reserved_mem_device_init()'
fails.
Goto the error handling path instead to free some resources.
Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
v2: Keep label name
Fix the commit message where a wrong function name was used
---
drivers/gpu/drm/kmb/kmb_drv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
index f64e06e1067d..fa28e42da460 100644
--- a/drivers/gpu/drm/kmb/kmb_drv.c
+++ b/drivers/gpu/drm/kmb/kmb_drv.c
@@ -144,7 +144,7 @@ static int kmb_hw_init(struct drm_device *drm, unsigned long flags)
/* Get the optional framebuffer memory resource */
ret = of_reserved_mem_device_init(drm->dev);
if (ret && ret != -ENODEV)
- return ret;
+ goto setup_fail;
spin_lock_init(&kmb->irq_lock);
@@ -153,7 +153,7 @@ static int kmb_hw_init(struct drm_device *drm, unsigned long flags)
return 0;
setup_fail:
- of_reserved_mem_device_release(drm->dev);
+ kmb_display_clk_disable(kmb);
return ret;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] drm/kmb: Do not report 0 (success) in case of error
2021-05-27 6:10 [PATCH v2 1/2] drm/kmb: Fix an error handling path Christophe JAILLET
@ 2021-05-27 6:10 ` Christophe JAILLET
2021-05-27 16:30 ` Chrisanthus, Anitha
0 siblings, 1 reply; 3+ messages in thread
From: Christophe JAILLET @ 2021-05-27 6:10 UTC (permalink / raw)
To: anitha.chrisanthus, edmund.j.dea, airlied, daniel, sam
Cc: Christophe JAILLET, kernel-janitors, linux-kernel, dri-devel
'ret' is known to be 0 at this point.
Reporting the error from the previous 'platform_get_irq()' call is likely,
so add the missing assignment.
Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
v2: New patch
---
drivers/gpu/drm/kmb/kmb_drv.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
index fa28e42da460..d9e10ac9847c 100644
--- a/drivers/gpu/drm/kmb/kmb_drv.c
+++ b/drivers/gpu/drm/kmb/kmb_drv.c
@@ -138,6 +138,7 @@ static int kmb_hw_init(struct drm_device *drm, unsigned long flags)
irq_lcd = platform_get_irq(pdev, 0);
if (irq_lcd < 0) {
drm_err(&kmb->drm, "irq_lcd not found");
+ ret = irq_lcd;
goto setup_fail;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH v2 2/2] drm/kmb: Do not report 0 (success) in case of error
2021-05-27 6:10 ` [PATCH v2 2/2] drm/kmb: Do not report 0 (success) in case of error Christophe JAILLET
@ 2021-05-27 16:30 ` Chrisanthus, Anitha
0 siblings, 0 replies; 3+ messages in thread
From: Chrisanthus, Anitha @ 2021-05-27 16:30 UTC (permalink / raw)
To: Christophe JAILLET, Dea, Edmund J, airlied, daniel, sam
Cc: kernel-janitors, linux-kernel, dri-devel
This is already fixed in the patch from Zhen Lei.
> -----Original Message-----
> From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Sent: Wednesday, May 26, 2021 11:10 PM
> To: Chrisanthus, Anitha <anitha.chrisanthus@intel.com>; Dea, Edmund J
> <edmund.j.dea@intel.com>; airlied@linux.ie; daniel@ffwll.ch;
> sam@ravnborg.org
> Cc: dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; kernel-
> janitors@vger.kernel.org; Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Subject: [PATCH v2 2/2] drm/kmb: Do not report 0 (success) in case of error
>
> 'ret' is known to be 0 at this point.
> Reporting the error from the previous 'platform_get_irq()' call is likely,
> so add the missing assignment.
>
> Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> v2: New patch
> ---
> drivers/gpu/drm/kmb/kmb_drv.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/kmb/kmb_drv.c
> b/drivers/gpu/drm/kmb/kmb_drv.c
> index fa28e42da460..d9e10ac9847c 100644
> --- a/drivers/gpu/drm/kmb/kmb_drv.c
> +++ b/drivers/gpu/drm/kmb/kmb_drv.c
> @@ -138,6 +138,7 @@ static int kmb_hw_init(struct drm_device *drm,
> unsigned long flags)
> irq_lcd = platform_get_irq(pdev, 0);
> if (irq_lcd < 0) {
> drm_err(&kmb->drm, "irq_lcd not found");
> + ret = irq_lcd;
> goto setup_fail;
> }
>
> --
> 2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-27 16:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27 6:10 [PATCH v2 1/2] drm/kmb: Fix an error handling path Christophe JAILLET
2021-05-27 6:10 ` [PATCH v2 2/2] drm/kmb: Do not report 0 (success) in case of error Christophe JAILLET
2021-05-27 16:30 ` Chrisanthus, Anitha
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).