All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] drm/nouveau/secboot: add gp102/gp104/gp106/gp107 support
@ 2017-03-10 20:55 Dan Carpenter
  2017-03-13  9:15 ` [Nouveau] " Alexandre Courbot
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-03-10 20:55 UTC (permalink / raw)
  To: acourbot-DDmLM1+adcrQT0dZR+AlfA
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Hello Alexandre Courbot,

The patch 5429f82f3415: "drm/nouveau/secboot: add
gp102/gp104/gp106/gp107 support" from Jan 26, 2017, leads to the
following static checker warning:

	drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp102.c:63 gp102_run_secure_scrub()
	warn: passing zero to 'PTR_ERR'

drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp102.c
    46  static int
    47  gp102_run_secure_scrub(struct nvkm_secboot *sb)
    48  {
    49          struct nvkm_subdev *subdev = &sb->subdev;
    50          struct nvkm_device *device = subdev->device;
    51          struct nvkm_engine *engine;
    52          struct nvkm_falcon *falcon;
    53          void *scrub_image;
    54          struct fw_bin_header *hsbin_hdr;
    55          struct hsf_fw_header *fw_hdr;
    56          struct hsf_load_header *lhdr;
    57          void *scrub_data;
    58          int ret;
    59  
    60          nvkm_debug(subdev, "running VPR scrubber binary on NVDEC...\n");
    61  
    62          if (!(engine = nvkm_engine_ref(&device->nvdec->engine)))
    63                  return PTR_ERR(engine);

This code doesn't make sense.  nvkm_engine_ref() isn't going to return
NULL because we're not passing a NULL to it.  I guess we should be
checking for ERR_PTR().  But really why does nvkm_engine_ref() ever
return NULL?  It feels like if we pass it a NULL pointer it should
return ERR_PTR(-EINVAL) on that path instead.

    64          falcon = device->nvdec->falcon;
    65  

regards,
dan carpenter
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

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

* Re: [Nouveau] [bug report] drm/nouveau/secboot: add gp102/gp104/gp106/gp107 support
  2017-03-10 20:55 [bug report] drm/nouveau/secboot: add gp102/gp104/gp106/gp107 support Dan Carpenter
@ 2017-03-13  9:15 ` Alexandre Courbot
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Courbot @ 2017-03-13  9:15 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: nouveau, dri-devel

On Sat, Mar 11, 2017 at 5:55 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> Hello Alexandre Courbot,
>
> The patch 5429f82f3415: "drm/nouveau/secboot: add
> gp102/gp104/gp106/gp107 support" from Jan 26, 2017, leads to the
> following static checker warning:
>
>         drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp102.c:63 gp102_run_secure_scrub()
>         warn: passing zero to 'PTR_ERR'
>
> drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp102.c
>     46  static int
>     47  gp102_run_secure_scrub(struct nvkm_secboot *sb)
>     48  {
>     49          struct nvkm_subdev *subdev = &sb->subdev;
>     50          struct nvkm_device *device = subdev->device;
>     51          struct nvkm_engine *engine;
>     52          struct nvkm_falcon *falcon;
>     53          void *scrub_image;
>     54          struct fw_bin_header *hsbin_hdr;
>     55          struct hsf_fw_header *fw_hdr;
>     56          struct hsf_load_header *lhdr;
>     57          void *scrub_data;
>     58          int ret;
>     59
>     60          nvkm_debug(subdev, "running VPR scrubber binary on NVDEC...\n");
>     61
>     62          if (!(engine = nvkm_engine_ref(&device->nvdec->engine)))
>     63                  return PTR_ERR(engine);
>
> This code doesn't make sense.  nvkm_engine_ref() isn't going to return
> NULL because we're not passing a NULL to it.  I guess we should be
> checking for ERR_PTR().  But really why does nvkm_engine_ref() ever
> return NULL?  It feels like if we pass it a NULL pointer it should
> return ERR_PTR(-EINVAL) on that path instead.

Indeed, not sure what I was smoking. The proper fix is to check for
ERR_PTR, will send a patch to fix it shortly. Thanks for the report!
_______________________________________________
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:[~2017-03-13  9:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-10 20:55 [bug report] drm/nouveau/secboot: add gp102/gp104/gp106/gp107 support Dan Carpenter
2017-03-13  9:15 ` [Nouveau] " Alexandre Courbot

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.