LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] media: rockchip/rga: do proper error checking in probe
@ 2021-11-20 12:23 Kyle Copperfield
  2021-11-22 12:32 ` Kieran Bingham
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Kyle Copperfield @ 2021-11-20 12:23 UTC (permalink / raw)
  To: Ezequiel Garcia, Mauro Carvalho Chehab, Heiko Stuebner, Dan Carpenter
  Cc: Kyle Copperfield, Dragan Simic, linux-media, linux-rockchip,
	linux-arm-kernel, linux-kernel

The latest fix for probe error handling contained a typo that causes
probing to fail with the following message:

  rockchip-rga: probe of ff680000.rga failed with error -12

This patch fixes the typo.

Fixes: e58430e1d4fd (media: rockchip/rga: fix error handling in probe)
Reviewed-by: Dragan Simic <dragan.simic@gmail.com>
Signed-off-by: Kyle Copperfield <kmcopper@danwin1210.me>
---
 drivers/media/platform/rockchip/rga/rga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c
index 6759091b15e0..d99ea8973b67 100644
--- a/drivers/media/platform/rockchip/rga/rga.c
+++ b/drivers/media/platform/rockchip/rga/rga.c
@@ -895,7 +895,7 @@ static int rga_probe(struct platform_device *pdev)
 	}
 	rga->dst_mmu_pages =
 		(unsigned int *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 3);
-	if (rga->dst_mmu_pages) {
+	if (!rga->dst_mmu_pages) {
 		ret = -ENOMEM;
 		goto free_src_pages;
 	}
-- 
2.34.0


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

* Re: [PATCH] media: rockchip/rga: do proper error checking in probe
  2021-11-20 12:23 [PATCH] media: rockchip/rga: do proper error checking in probe Kyle Copperfield
@ 2021-11-22 12:32 ` Kieran Bingham
  2021-11-22 12:38 ` Dan Carpenter
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Kieran Bingham @ 2021-11-22 12:32 UTC (permalink / raw)
  To: Dan Carpenter, Ezequiel Garcia, Heiko Stuebner, Kyle Copperfield,
	Mauro Carvalho Chehab
  Cc: Kyle Copperfield, Dragan Simic, linux-media, linux-rockchip,
	linux-arm-kernel, linux-kernel

Quoting Kyle Copperfield (2021-11-20 12:23:02)
> The latest fix for probe error handling contained a typo that causes
> probing to fail with the following message:
> 
>   rockchip-rga: probe of ff680000.rga failed with error -12
> 
> This patch fixes the typo.
> 
> Fixes: e58430e1d4fd (media: rockchip/rga: fix error handling in probe)
> Reviewed-by: Dragan Simic <dragan.simic@gmail.com>
> Signed-off-by: Kyle Copperfield <kmcopper@danwin1210.me>
> ---
>  drivers/media/platform/rockchip/rga/rga.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c
> index 6759091b15e0..d99ea8973b67 100644
> --- a/drivers/media/platform/rockchip/rga/rga.c
> +++ b/drivers/media/platform/rockchip/rga/rga.c
> @@ -895,7 +895,7 @@ static int rga_probe(struct platform_device *pdev)
>         }
>         rga->dst_mmu_pages =
>                 (unsigned int *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 3);
> -       if (rga->dst_mmu_pages) {
> +       if (!rga->dst_mmu_pages) {

Ouch, that indeed looks like it was unhelpful..

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

>                 ret = -ENOMEM;
>                 goto free_src_pages;
>         }
> -- 
> 2.34.0
>

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

* Re: [PATCH] media: rockchip/rga: do proper error checking in probe
  2021-11-20 12:23 [PATCH] media: rockchip/rga: do proper error checking in probe Kyle Copperfield
  2021-11-22 12:32 ` Kieran Bingham
@ 2021-11-22 12:38 ` Dan Carpenter
  2021-11-25  9:39 ` Nicolas Frattaroli
  2021-11-25 12:25 ` Dan Carpenter
  3 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2021-11-22 12:38 UTC (permalink / raw)
  To: Kyle Copperfield
  Cc: Ezequiel Garcia, Mauro Carvalho Chehab, Heiko Stuebner,
	Dragan Simic, linux-media, linux-rockchip, linux-arm-kernel,
	linux-kernel

On Sat, Nov 20, 2021 at 12:23:02PM +0000, Kyle Copperfield wrote:
> The latest fix for probe error handling contained a typo that causes
> probing to fail with the following message:
> 
>   rockchip-rga: probe of ff680000.rga failed with error -12
> 
> This patch fixes the typo.
> 
> Fixes: e58430e1d4fd (media: rockchip/rga: fix error handling in probe)
> Reviewed-by: Dragan Simic <dragan.simic@gmail.com>
> Signed-off-by: Kyle Copperfield <kmcopper@danwin1210.me>

Sorry about that!

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter


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

* Re: [PATCH] media: rockchip/rga: do proper error checking in probe
  2021-11-20 12:23 [PATCH] media: rockchip/rga: do proper error checking in probe Kyle Copperfield
  2021-11-22 12:32 ` Kieran Bingham
  2021-11-22 12:38 ` Dan Carpenter
@ 2021-11-25  9:39 ` Nicolas Frattaroli
  2021-11-25 12:25 ` Dan Carpenter
  3 siblings, 0 replies; 5+ messages in thread
From: Nicolas Frattaroli @ 2021-11-25  9:39 UTC (permalink / raw)
  To: Ezequiel Garcia, Mauro Carvalho Chehab, Heiko Stuebner,
	Dan Carpenter, linux-rockchip
  Cc: Kyle Copperfield, Dragan Simic, linux-media, linux-rockchip,
	linux-arm-kernel, linux-kernel, Kyle Copperfield

On Samstag, 20. November 2021 13:23:02 CET Kyle Copperfield wrote:
> The latest fix for probe error handling contained a typo that causes
> probing to fail with the following message:
> 
>   rockchip-rga: probe of ff680000.rga failed with error -12
> 
> This patch fixes the typo.
> 
> Fixes: e58430e1d4fd (media: rockchip/rga: fix error handling in probe)
> Reviewed-by: Dragan Simic <dragan.simic@gmail.com>
> Signed-off-by: Kyle Copperfield <kmcopper@danwin1210.me>
> ---

Tested-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>

Fixes RGA probing for me, many thanks!



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

* Re: [PATCH] media: rockchip/rga: do proper error checking in probe
  2021-11-20 12:23 [PATCH] media: rockchip/rga: do proper error checking in probe Kyle Copperfield
                   ` (2 preceding siblings ...)
  2021-11-25  9:39 ` Nicolas Frattaroli
@ 2021-11-25 12:25 ` Dan Carpenter
  3 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2021-11-25 12:25 UTC (permalink / raw)
  To: Kyle Copperfield
  Cc: Ezequiel Garcia, Mauro Carvalho Chehab, Heiko Stuebner,
	Dragan Simic, linux-media, linux-rockchip, linux-arm-kernel,
	linux-kernel

On Sat, Nov 20, 2021 at 12:23:02PM +0000, Kyle Copperfield wrote:
> The latest fix for probe error handling contained a typo that causes
> probing to fail with the following message:
> 
>   rockchip-rga: probe of ff680000.rga failed with error -12
> 
> This patch fixes the typo.
> 
> Fixes: e58430e1d4fd (media: rockchip/rga: fix error handling in probe)
> Reviewed-by: Dragan Simic <dragan.simic@gmail.com>
> Signed-off-by: Kyle Copperfield <kmcopper@danwin1210.me>
> ---
>  drivers/media/platform/rockchip/rga/rga.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c
> index 6759091b15e0..d99ea8973b67 100644
> --- a/drivers/media/platform/rockchip/rga/rga.c
> +++ b/drivers/media/platform/rockchip/rga/rga.c
> @@ -895,7 +895,7 @@ static int rga_probe(struct platform_device *pdev)
>  	}
>  	rga->dst_mmu_pages =
>  		(unsigned int *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 3);
> -	if (rga->dst_mmu_pages) {
> +	if (!rga->dst_mmu_pages) {
>  		ret = -ENOMEM;
>  		goto free_src_pages;
>  	}

There was supposed to be Smatch warning to catch this bug but Smatch was
not parsing __get_free_pages() correctly.  I've fixed that so it
generates a warning now.

drivers/media/platform/rockchip/rga/rga.c:928 rga_probe() warn: 'rga->dst_mmu_pages' from __get_free_pages() not released on lines: 928.

Also I have introduced a new checker warning for code like:

	foo = alloc();
	if (foo)
		ret = -ENOMEM;

drivers/media/platform/rockchip/rga/rga.c:896 rga_probe() warn: inverted NULL check

I will test that out tonight.  I've also created a warning for if we
return success when a function returns NULL but I'm not really
optimistic that it will work.  Still, you never know until you check so
I'll test that out as well.

drivers/media/platform/rockchip/rga/rga.c:912 rga_probe() warn: success when 'rga->dst_mmu_pages' is NULL'

regards,
dan carpenter

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

end of thread, other threads:[~2021-11-25 12:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-20 12:23 [PATCH] media: rockchip/rga: do proper error checking in probe Kyle Copperfield
2021-11-22 12:32 ` Kieran Bingham
2021-11-22 12:38 ` Dan Carpenter
2021-11-25  9:39 ` Nicolas Frattaroli
2021-11-25 12:25 ` Dan Carpenter

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).