dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nouveau/secboot/gm20b: initialize pointer in gm20b_secboot_new()
@ 2020-01-08  5:46 Dan Carpenter
  2020-01-08 23:58 ` Ben Skeggs
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-01-08  5:46 UTC (permalink / raw)
  To: Ben Skeggs
  Cc: David Airlie, nouveau, kernel-janitors, dri-devel, Alexandre Courbot

We accidentally set "psb" which is a no-op instead of "*psb" so it
generates a static checker warning.  We should probably set it before
the first error return so that it's always initialized.

Fixes: 923f1bd27bf1 ("drm/nouveau/secboot/gm20b: add secure boot support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static analysis.  I'm not sure how this is called.

 drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
index df8b919dcf09..ace6fefba428 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
@@ -108,6 +108,7 @@ gm20b_secboot_new(struct nvkm_device *device, int index,
 	struct gm200_secboot *gsb;
 	struct nvkm_acr *acr;
 
+	*psb = NULL;
 	acr = acr_r352_new(BIT(NVKM_SECBOOT_FALCON_FECS) |
 			   BIT(NVKM_SECBOOT_FALCON_PMU));
 	if (IS_ERR(acr))
@@ -116,10 +117,8 @@ gm20b_secboot_new(struct nvkm_device *device, int index,
 	acr->optional_falcons = BIT(NVKM_SECBOOT_FALCON_PMU);
 
 	gsb = kzalloc(sizeof(*gsb), GFP_KERNEL);
-	if (!gsb) {
-		psb = NULL;
+	if (!gsb)
 		return -ENOMEM;
-	}
 	*psb = &gsb->base;
 
 	ret = nvkm_secboot_ctor(&gm20b_secboot, acr, device, index, &gsb->base);
-- 
2.11.0

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

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

* Re: [PATCH] nouveau/secboot/gm20b: initialize pointer in gm20b_secboot_new()
  2020-01-08  5:46 [PATCH] nouveau/secboot/gm20b: initialize pointer in gm20b_secboot_new() Dan Carpenter
@ 2020-01-08 23:58 ` Ben Skeggs
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Skeggs @ 2020-01-08 23:58 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: David Airlie, ML nouveau, kernel-janitors, ML dri-devel,
	Alexandre Courbot, Ben Skeggs

On Wed, 8 Jan 2020 at 15:46, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> We accidentally set "psb" which is a no-op instead of "*psb" so it
> generates a static checker warning.  We should probably set it before
> the first error return so that it's always initialized.
You actually don't need to do either, *psb will be NULL already on
entry to the function.  But removing the assignment in the error path
should be done still.

Ben.

>
> Fixes: 923f1bd27bf1 ("drm/nouveau/secboot/gm20b: add secure boot support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Static analysis.  I'm not sure how this is called.
>
>  drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
> index df8b919dcf09..ace6fefba428 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
> @@ -108,6 +108,7 @@ gm20b_secboot_new(struct nvkm_device *device, int index,
>         struct gm200_secboot *gsb;
>         struct nvkm_acr *acr;
>
> +       *psb = NULL;
>         acr = acr_r352_new(BIT(NVKM_SECBOOT_FALCON_FECS) |
>                            BIT(NVKM_SECBOOT_FALCON_PMU));
>         if (IS_ERR(acr))
> @@ -116,10 +117,8 @@ gm20b_secboot_new(struct nvkm_device *device, int index,
>         acr->optional_falcons = BIT(NVKM_SECBOOT_FALCON_PMU);
>
>         gsb = kzalloc(sizeof(*gsb), GFP_KERNEL);
> -       if (!gsb) {
> -               psb = NULL;
> +       if (!gsb)
>                 return -ENOMEM;
> -       }
>         *psb = &gsb->base;
>
>         ret = nvkm_secboot_ctor(&gm20b_secboot, acr, device, index, &gsb->base);
> --
> 2.11.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2020-01-08 23:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-08  5:46 [PATCH] nouveau/secboot/gm20b: initialize pointer in gm20b_secboot_new() Dan Carpenter
2020-01-08 23:58 ` Ben Skeggs

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