From: Dan Carpenter <dan.carpenter@linaro.org>
To: "Lazar, Lijo" <lijo.lazar@amd.com>
Cc: Ce Sun <cesun102@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: Replace tmp_adev with hive in amdgpu_pci_slot_reset
Date: Wed, 9 Apr 2025 16:56:46 +0300 [thread overview]
Message-ID: <a6e37b47-a089-436d-be55-da298e844d14@stanley.mountain> (raw)
In-Reply-To: <a79917f2-0883-4855-9802-9c1f127c8f02@amd.com>
On Wed, Apr 09, 2025 at 07:19:25PM +0530, Lazar, Lijo wrote:
>
>
> On 4/9/2025 7:09 PM, Ce Sun wrote:
> > Checking hive is more readable.
> >
> > The following smatch warning:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:6820 amdgpu_pci_slot_reset()
> > warn: iterator used outside loop: 'tmp_adev'
> >
> > Fixes: 8ba904f54148 ("drm/amdgpu: Multi-GPU DPC recovery support")
> > Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> > Signed-off-by: Ce Sun <cesun102@amd.com>
> > ---
> > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > index 60269fba5745..6fb234832ff3 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> > @@ -6784,8 +6784,8 @@ pci_ers_result_t amdgpu_pci_slot_reset(struct pci_dev *pdev)
> > struct drm_device *dev = pci_get_drvdata(pdev);
> > struct amdgpu_device *adev = drm_to_adev(dev);
> > struct amdgpu_reset_context reset_context;
> > - struct amdgpu_device *tmp_adev = NULL;
> > - struct amdgpu_hive_info *hive = NULL;
> > + struct amdgpu_device *tmp_adev;
> > + struct amdgpu_hive_info *hive;
> > struct list_head device_list;
> > int r = 0, i;
> > u32 memsize;
> > @@ -6846,7 +6846,7 @@ pci_ers_result_t amdgpu_pci_slot_reset(struct pci_dev *pdev)
> > dev_info(adev->dev, "PCIe error recovery succeeded\n");
> > } else {
> > dev_err(adev->dev, "PCIe error recovery failed, err:%d\n", r);
> > - if (tmp_adev) {
> > + if (hive) {
>
> This doesn't look correct. I think the original logic is to have a
> single device list or multi-device list when there is a hive. Now this
> skips the step for single device case.
>
I don't know what the original intentions were, but what I know is that
this code will behave exactly the same as the original code.
regards,
dan carpenter
next prev parent reply other threads:[~2025-04-10 13:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-09 13:39 [PATCH] drm/amdgpu: Replace tmp_adev with hive in amdgpu_pci_slot_reset Ce Sun
2025-04-09 13:44 ` Christian König
2025-04-09 13:49 ` Lazar, Lijo
2025-04-09 13:56 ` Dan Carpenter [this message]
2025-04-10 8:09 ` Lazar, Lijo
-- strict thread matches above, loose matches on Subject: below --
2025-04-09 13:18 Ce Sun
2025-04-09 13:32 ` Christian König
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=a6e37b47-a089-436d-be55-da298e844d14@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=amd-gfx@lists.freedesktop.org \
--cc=cesun102@amd.com \
--cc=lijo.lazar@amd.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 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.