From: Dan Carpenter <dan.carpenter@oracle.com>
To: Kyle Copperfield <kmcopper@danwin1210.me>
Cc: Ezequiel Garcia <ezequiel@collabora.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Heiko Stuebner <heiko@sntech.de>,
Dragan Simic <dragan.simic@gmail.com>,
linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: rockchip/rga: do proper error checking in probe
Date: Thu, 25 Nov 2021 15:25:38 +0300 [thread overview]
Message-ID: <20211125122538.GF18178@kadam> (raw)
In-Reply-To: <20211120122321.20253-1-kmcopper@danwin1210.me>
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
prev parent reply other threads:[~2021-11-25 12:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
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=20211125122538.GF18178@kadam \
--to=dan.carpenter@oracle.com \
--cc=dragan.simic@gmail.com \
--cc=ezequiel@collabora.com \
--cc=heiko@sntech.de \
--cc=kmcopper@danwin1210.me \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mchehab@kernel.org \
/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