From: "Christian König" <christian.koenig@amd.com>
To: Zhouyi Zhou <zhouzhouyi@gmail.com>,
alexander.deucher@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com,
daniel@ffwll.ch, chris@chrisdown.name,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, rcu@vger.kernel.org,
lance@osuosl.org
Subject: Re: [PATCH] drm/radeon/r100: enhance error handling in r100_cp_init_microcode
Date: Mon, 27 May 2024 09:58:11 +0200 [thread overview]
Message-ID: <c60b572e-12a8-49b1-a75a-b8a7b7ed674b@amd.com> (raw)
In-Reply-To: <20240527012018.351223-1-zhouzhouyi@gmail.com>
Am 27.05.24 um 03:20 schrieb Zhouyi Zhou:
> In r100_cp_init_microcode, if rdev->family don't match any of
> if statement, fw_name will be NULL, which will cause
> gcc (11.4.0 powerpc64le-linux-gnu) complain:
>
> In function ‘r100_cp_init_microcode’,
> inlined from ‘r100_cp_init’ at drivers/gpu/drm/radeon/r100.c:1136:7:
> ./include/linux/printk.h:457:44: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
> 457 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
>
> Above warning is emitted during the rcutorture test in
> in PPC VM of Opensource Lab of Oregon State Univerisity.
>
> Enhance error handling in r100_cp_init_microcode, let r100_cp_init_microcode
> return with -EINVAL when none of chip families is matched.
>
> Signed-off-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
> ---
> drivers/gpu/drm/radeon/r100.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
> index 0b1e19345f43..4f8a1bdd9365 100644
> --- a/drivers/gpu/drm/radeon/r100.c
> +++ b/drivers/gpu/drm/radeon/r100.c
> @@ -1055,6 +1055,11 @@ static int r100_cp_init_microcode(struct radeon_device *rdev)
> (rdev->family == CHIP_RV570)) {
> DRM_INFO("Loading R500 Microcode\n");
> fw_name = FIRMWARE_R520;
> + } else {
> + pr_err("radeon_cp: Failed to load firmware \"%d\"\n",
> + rdev->family);
> + err = -EINVAL;
> + goto out;
> }
>
> err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
> @@ -1067,6 +1072,8 @@ static int r100_cp_init_microcode(struct radeon_device *rdev)
> release_firmware(rdev->me_fw);
> rdev->me_fw = NULL;
> }
> +
> +out:
That looks superfluous, just return -EINVAL directly in the else case above.
Apart from that this is for ~15year old hardware. I'm a bit reluctant
adding code for something that old even when this change here looks
harmless.
Is there a plan to complain about that in an automated checker? If yes
then the change is probably justified, if no then I would rather not do it.
Regards,
Christian.
> return err;
> }
>
next prev parent reply other threads:[~2024-05-27 7:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 1:20 [PATCH] drm/radeon/r100: enhance error handling in r100_cp_init_microcode Zhouyi Zhou
2024-05-27 7:58 ` Christian König [this message]
2024-05-28 1:36 ` Zhouyi Zhou
2024-05-28 1:45 ` Zhouyi Zhou
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=c60b572e-12a8-49b1-a75a-b8a7b7ed674b@amd.com \
--to=christian.koenig@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=chris@chrisdown.name \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=lance@osuosl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rcu@vger.kernel.org \
--cc=zhouzhouyi@gmail.com \
/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