linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau/acr/ga102: fix NULL vs IS_ERR() check in ga102_acr_wpr_parse()
@ 2025-09-02  6:35 Dan Carpenter
  2025-09-02  9:48 ` Nirmoy Das
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-09-02  6:35 UTC (permalink / raw)
  To: Ben Skeggs
  Cc: Lyude Paul, Danilo Krummrich, David Airlie, Simona Vetter,
	Gourav Samaiya, dri-devel, nouveau, linux-kernel, kernel-janitors

The nvkm_acr_lsfw_add() function never returns NULL, it returns error
pointers.  Update the check to match.

Fixes: 4b569ded09fd ("drm/nouveau/acr/ga102: initial support")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c
index c7d38609bb7e..aae96a94acee 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c
@@ -218,11 +218,13 @@ static int
 ga102_acr_wpr_parse(struct nvkm_acr *acr)
 {
 	const struct wpr_header_v2 *hdr = (void *)acr->wpr_fw->data;
+	struct nvkm_acr_lsfw *lsfw;
 
 	while (hdr->wpr.falcon_id != WPR_HEADER_V1_FALCON_ID_INVALID) {
 		wpr_header_v2_dump(&acr->subdev, hdr);
-		if (!nvkm_acr_lsfw_add(NULL, acr, NULL, (hdr++)->wpr.falcon_id))
-			return -ENOMEM;
+		lsfw = nvkm_acr_lsfw_add(NULL, acr, NULL, (hdr++)->wpr.falcon_id);
+		if (IS_ERR(lsfw))
+			return PTR_ERR(lsfw);
 	}
 
 	return 0;
-- 
2.47.2


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

* Re: [PATCH] drm/nouveau/acr/ga102: fix NULL vs IS_ERR() check in ga102_acr_wpr_parse()
  2025-09-02  6:35 [PATCH] drm/nouveau/acr/ga102: fix NULL vs IS_ERR() check in ga102_acr_wpr_parse() Dan Carpenter
@ 2025-09-02  9:48 ` Nirmoy Das
  0 siblings, 0 replies; 2+ messages in thread
From: Nirmoy Das @ 2025-09-02  9:48 UTC (permalink / raw)
  To: Dan Carpenter, Ben Skeggs
  Cc: Lyude Paul, Danilo Krummrich, David Airlie, Simona Vetter,
	Gourav Samaiya, dri-devel, nouveau, linux-kernel, kernel-janitors


On 02.09.25 08:35, Dan Carpenter wrote:
> The nvkm_acr_lsfw_add() function never returns NULL, it returns error
> pointers.  Update the check to match.
>
> Fixes: 4b569ded09fd ("drm/nouveau/acr/ga102: initial support")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Nirmoy Das <nirmoyd@nvidia.com>
> ---
>   drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c
> index c7d38609bb7e..aae96a94acee 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c
> @@ -218,11 +218,13 @@ static int
>   ga102_acr_wpr_parse(struct nvkm_acr *acr)
>   {
>   	const struct wpr_header_v2 *hdr = (void *)acr->wpr_fw->data;
> +	struct nvkm_acr_lsfw *lsfw;
>   
>   	while (hdr->wpr.falcon_id != WPR_HEADER_V1_FALCON_ID_INVALID) {
>   		wpr_header_v2_dump(&acr->subdev, hdr);
> -		if (!nvkm_acr_lsfw_add(NULL, acr, NULL, (hdr++)->wpr.falcon_id))
> -			return -ENOMEM;
> +		lsfw = nvkm_acr_lsfw_add(NULL, acr, NULL, (hdr++)->wpr.falcon_id);
> +		if (IS_ERR(lsfw))
> +			return PTR_ERR(lsfw);
>   	}
>   
>   	return 0;

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

end of thread, other threads:[~2025-09-02  9:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-02  6:35 [PATCH] drm/nouveau/acr/ga102: fix NULL vs IS_ERR() check in ga102_acr_wpr_parse() Dan Carpenter
2025-09-02  9:48 ` Nirmoy Das

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