All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/amdgpu: fix an error code in init_pmu_entry_by_type_and_add()
@ 2021-04-14  5:58 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-04-14  5:58 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Christian König, David Airlie, Daniel Vetter,
	Harish Kasiviswanathan, Jonathan Kim, Luben Tuikov, amd-gfx,
	dri-devel, kernel-janitors

If the kmemdup() fails then this should return a negative error code
but it currently returns success

Fixes: b4a7db71ea06 ("drm/amdgpu: add per device user friendly xgmi events for vega20")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: I sent this patch in Feb but I accidentally added an unrelated
hunk from nouveau to the commit.  Now both hunks are have been sent to
the correct lists.

 drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
index 19c0a3655228..82e9ecf84352 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
@@ -519,8 +519,10 @@ static int init_pmu_entry_by_type_and_add(struct amdgpu_pmu_entry *pmu_entry,
 	pmu_entry->pmu.attr_groups = kmemdup(attr_groups, sizeof(attr_groups),
 								GFP_KERNEL);
 
-	if (!pmu_entry->pmu.attr_groups)
+	if (!pmu_entry->pmu.attr_groups) {
+		ret = -ENOMEM;
 		goto err_attr_group;
+	}
 
 	snprintf(pmu_name, PMU_NAME_SIZE, "%s_%d", pmu_entry->pmu_file_prefix,
 				adev_to_drm(pmu_entry->adev)->primary->index);
-- 
2.30.2


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

* [PATCH v2] drm/amdgpu: fix an error code in init_pmu_entry_by_type_and_add()
@ 2021-04-14  5:58 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-04-14  5:58 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Jonathan Kim, David Airlie, kernel-janitors,
	Harish Kasiviswanathan, amd-gfx, Luben Tuikov, dri-devel,
	Christian König

If the kmemdup() fails then this should return a negative error code
but it currently returns success

Fixes: b4a7db71ea06 ("drm/amdgpu: add per device user friendly xgmi events for vega20")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: I sent this patch in Feb but I accidentally added an unrelated
hunk from nouveau to the commit.  Now both hunks are have been sent to
the correct lists.

 drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
index 19c0a3655228..82e9ecf84352 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
@@ -519,8 +519,10 @@ static int init_pmu_entry_by_type_and_add(struct amdgpu_pmu_entry *pmu_entry,
 	pmu_entry->pmu.attr_groups = kmemdup(attr_groups, sizeof(attr_groups),
 								GFP_KERNEL);
 
-	if (!pmu_entry->pmu.attr_groups)
+	if (!pmu_entry->pmu.attr_groups) {
+		ret = -ENOMEM;
 		goto err_attr_group;
+	}
 
 	snprintf(pmu_name, PMU_NAME_SIZE, "%s_%d", pmu_entry->pmu_file_prefix,
 				adev_to_drm(pmu_entry->adev)->primary->index);
-- 
2.30.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v2] drm/amdgpu: fix an error code in init_pmu_entry_by_type_and_add()
@ 2021-04-14  5:58 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-04-14  5:58 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Jonathan Kim, David Airlie, kernel-janitors,
	Harish Kasiviswanathan, amd-gfx, Luben Tuikov, dri-devel,
	Daniel Vetter, Christian König

If the kmemdup() fails then this should return a negative error code
but it currently returns success

Fixes: b4a7db71ea06 ("drm/amdgpu: add per device user friendly xgmi events for vega20")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: I sent this patch in Feb but I accidentally added an unrelated
hunk from nouveau to the commit.  Now both hunks are have been sent to
the correct lists.

 drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
index 19c0a3655228..82e9ecf84352 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
@@ -519,8 +519,10 @@ static int init_pmu_entry_by_type_and_add(struct amdgpu_pmu_entry *pmu_entry,
 	pmu_entry->pmu.attr_groups = kmemdup(attr_groups, sizeof(attr_groups),
 								GFP_KERNEL);
 
-	if (!pmu_entry->pmu.attr_groups)
+	if (!pmu_entry->pmu.attr_groups) {
+		ret = -ENOMEM;
 		goto err_attr_group;
+	}
 
 	snprintf(pmu_name, PMU_NAME_SIZE, "%s_%d", pmu_entry->pmu_file_prefix,
 				adev_to_drm(pmu_entry->adev)->primary->index);
-- 
2.30.2

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH v2] drm/amdgpu: fix an error code in init_pmu_entry_by_type_and_add()
  2021-04-14  5:58 ` Dan Carpenter
  (?)
@ 2021-04-15 16:21   ` Alex Deucher
  -1 siblings, 0 replies; 6+ messages in thread
From: Alex Deucher @ 2021-04-15 16:21 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Alex Deucher, Jonathan Kim, David Airlie, kernel-janitors,
	Harish Kasiviswanathan, amd-gfx list, Luben Tuikov,
	Maling list - DRI developers, Daniel Vetter,
	Christian König

On Wed, Apr 14, 2021 at 1:59 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> If the kmemdup() fails then this should return a negative error code
> but it currently returns success
>
> Fixes: b4a7db71ea06 ("drm/amdgpu: add per device user friendly xgmi events for vega20")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.  Thanks!

Alex

> ---
> v2: I sent this patch in Feb but I accidentally added an unrelated
> hunk from nouveau to the commit.  Now both hunks are have been sent to
> the correct lists.
>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> index 19c0a3655228..82e9ecf84352 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> @@ -519,8 +519,10 @@ static int init_pmu_entry_by_type_and_add(struct amdgpu_pmu_entry *pmu_entry,
>         pmu_entry->pmu.attr_groups = kmemdup(attr_groups, sizeof(attr_groups),
>                                                                 GFP_KERNEL);
>
> -       if (!pmu_entry->pmu.attr_groups)
> +       if (!pmu_entry->pmu.attr_groups) {
> +               ret = -ENOMEM;
>                 goto err_attr_group;
> +       }
>
>         snprintf(pmu_name, PMU_NAME_SIZE, "%s_%d", pmu_entry->pmu_file_prefix,
>                                 adev_to_drm(pmu_entry->adev)->primary->index);
> --
> 2.30.2
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH v2] drm/amdgpu: fix an error code in init_pmu_entry_by_type_and_add()
@ 2021-04-15 16:21   ` Alex Deucher
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Deucher @ 2021-04-15 16:21 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jonathan Kim, David Airlie, kernel-janitors,
	Harish Kasiviswanathan, amd-gfx list, Luben Tuikov,
	Maling list - DRI developers, Alex Deucher, Christian König

On Wed, Apr 14, 2021 at 1:59 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> If the kmemdup() fails then this should return a negative error code
> but it currently returns success
>
> Fixes: b4a7db71ea06 ("drm/amdgpu: add per device user friendly xgmi events for vega20")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.  Thanks!

Alex

> ---
> v2: I sent this patch in Feb but I accidentally added an unrelated
> hunk from nouveau to the commit.  Now both hunks are have been sent to
> the correct lists.
>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> index 19c0a3655228..82e9ecf84352 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> @@ -519,8 +519,10 @@ static int init_pmu_entry_by_type_and_add(struct amdgpu_pmu_entry *pmu_entry,
>         pmu_entry->pmu.attr_groups = kmemdup(attr_groups, sizeof(attr_groups),
>                                                                 GFP_KERNEL);
>
> -       if (!pmu_entry->pmu.attr_groups)
> +       if (!pmu_entry->pmu.attr_groups) {
> +               ret = -ENOMEM;
>                 goto err_attr_group;
> +       }
>
>         snprintf(pmu_name, PMU_NAME_SIZE, "%s_%d", pmu_entry->pmu_file_prefix,
>                                 adev_to_drm(pmu_entry->adev)->primary->index);
> --
> 2.30.2
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v2] drm/amdgpu: fix an error code in init_pmu_entry_by_type_and_add()
@ 2021-04-15 16:21   ` Alex Deucher
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Deucher @ 2021-04-15 16:21 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jonathan Kim, David Airlie, kernel-janitors,
	Harish Kasiviswanathan, amd-gfx list, Luben Tuikov,
	Maling list - DRI developers, Daniel Vetter, Alex Deucher,
	Christian König

On Wed, Apr 14, 2021 at 1:59 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> If the kmemdup() fails then this should return a negative error code
> but it currently returns success
>
> Fixes: b4a7db71ea06 ("drm/amdgpu: add per device user friendly xgmi events for vega20")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.  Thanks!

Alex

> ---
> v2: I sent this patch in Feb but I accidentally added an unrelated
> hunk from nouveau to the commit.  Now both hunks are have been sent to
> the correct lists.
>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> index 19c0a3655228..82e9ecf84352 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
> @@ -519,8 +519,10 @@ static int init_pmu_entry_by_type_and_add(struct amdgpu_pmu_entry *pmu_entry,
>         pmu_entry->pmu.attr_groups = kmemdup(attr_groups, sizeof(attr_groups),
>                                                                 GFP_KERNEL);
>
> -       if (!pmu_entry->pmu.attr_groups)
> +       if (!pmu_entry->pmu.attr_groups) {
> +               ret = -ENOMEM;
>                 goto err_attr_group;
> +       }
>
>         snprintf(pmu_name, PMU_NAME_SIZE, "%s_%d", pmu_entry->pmu_file_prefix,
>                                 adev_to_drm(pmu_entry->adev)->primary->index);
> --
> 2.30.2
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2021-04-15 16:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-14  5:58 [PATCH v2] drm/amdgpu: fix an error code in init_pmu_entry_by_type_and_add() Dan Carpenter
2021-04-14  5:58 ` Dan Carpenter
2021-04-14  5:58 ` Dan Carpenter
2021-04-15 16:21 ` Alex Deucher
2021-04-15 16:21   ` Alex Deucher
2021-04-15 16:21   ` Alex Deucher

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.