dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] drm/amdgpu: fix error return code in amdgpu_acpi_init()
@ 2021-05-24 13:35 Wei Yongjun
  2021-05-24 18:12 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2021-05-24 13:35 UTC (permalink / raw)
  To: weiyongjun1, Alex Deucher, Christian König, Pan, Xinhui,
	David Airlie, Daniel Vetter, Prike Liang, Lijo Lazar,
	Rajneesh Bhardwaj, Ye Bin, Likun Gao, Fabio M. De Francesco
  Cc: Hulk Robot, kernel-janitors, dri-devel, amd-gfx, linux-kernel

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 77bf762f8b30 ("drm/amdgpu/acpi: unify ATCS handling (v3)")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
index 49563ff87f1a..9564690b21b4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
@@ -895,12 +895,15 @@ int amdgpu_acpi_init(struct amdgpu_device *adev)
 atcs:
 	/* Probe for ATCS, and initialize it if found */
 	atcs_handle = amdgpu_atcs_probe_handle(handle);
-	if (!atcs_handle)
+	if (!atcs_handle) {
+		ret = -ENODEV;
 		goto out;
+	}
 
 	atcs = kzalloc(sizeof(*atcs), GFP_KERNEL);
 	if (!atcs) {
 		DRM_WARN("Not enough memory to initialize ATCS\n");
+		ret = -ENOMEM;
 		goto out;
 	}
 	atcs->handle = atcs_handle;


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

* Re: [PATCH -next] drm/amdgpu: fix error return code in amdgpu_acpi_init()
  2021-05-24 13:35 [PATCH -next] drm/amdgpu: fix error return code in amdgpu_acpi_init() Wei Yongjun
@ 2021-05-24 18:12 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2021-05-24 18:12 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Lijo Lazar, David Airlie, Pan, Xinhui, kernel-janitors,
	Rajneesh Bhardwaj, Maling list - DRI developers, LKML,
	Hulk Robot, Prike Liang, amd-gfx list, Alex Deucher, Likun Gao,
	Fabio M. De Francesco, Christian König, Ye Bin

On Mon, May 24, 2021 at 9:25 AM Wei Yongjun <weiyongjun1@huawei.com> wrote:
>
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.

I don't see any other cases in this function where we return an error.
It could arguably be made a void.  All of these APCI methods are
optional.

Alex

>
> Fixes: 77bf762f8b30 ("drm/amdgpu/acpi: unify ATCS handling (v3)")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> index 49563ff87f1a..9564690b21b4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> @@ -895,12 +895,15 @@ int amdgpu_acpi_init(struct amdgpu_device *adev)
>  atcs:
>         /* Probe for ATCS, and initialize it if found */
>         atcs_handle = amdgpu_atcs_probe_handle(handle);
> -       if (!atcs_handle)
> +       if (!atcs_handle) {
> +               ret = -ENODEV;
>                 goto out;
> +       }
>
>         atcs = kzalloc(sizeof(*atcs), GFP_KERNEL);
>         if (!atcs) {
>                 DRM_WARN("Not enough memory to initialize ATCS\n");
> +               ret = -ENOMEM;
>                 goto out;
>         }
>         atcs->handle = atcs_handle;
>

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

end of thread, other threads:[~2021-05-24 18:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24 13:35 [PATCH -next] drm/amdgpu: fix error return code in amdgpu_acpi_init() Wei Yongjun
2021-05-24 18:12 ` Alex Deucher

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