linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] [media] davinci: vpif_capture: get subdevs from DT when available
@ 2017-07-11 13:08 Dan Carpenter
  2017-07-11 19:09 ` Kevin Hilman
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-07-11 13:08 UTC (permalink / raw)
  To: khilman; +Cc: linux-media

Hello Kevin Hilman,

The patch 4a5f8ae50b66: "[media] davinci: vpif_capture: get subdevs
from DT when available" from Jun 6, 2017, leads to the following
static checker warning:

	drivers/media/platform/davinci/vpif_capture.c:1596 vpif_capture_get_pdata()
	error: potential NULL dereference 'pdata'.

drivers/media/platform/davinci/vpif_capture.c
  1576  
  1577                  dev_dbg(&pdev->dev, "Remote device %s, %s found\n",
  1578                          rem->name, rem->full_name);
  1579                  sdinfo->name = rem->full_name;
  1580  
  1581                  pdata->asd[i] = devm_kzalloc(&pdev->dev,
  1582                                               sizeof(struct v4l2_async_subdev),
  1583                                               GFP_KERNEL);
  1584                  if (!pdata->asd[i]) {
  1585                          of_node_put(rem);
  1586                          pdata = NULL;
                                ^^^^^^^^^^^^
Set to NULL

  1587                          goto done;
  1588                  }
  1589  
  1590                  pdata->asd[i]->match_type = V4L2_ASYNC_MATCH_FWNODE;
  1591                  pdata->asd[i]->match.fwnode.fwnode = of_fwnode_handle(rem);
  1592                  of_node_put(rem);
  1593          }
  1594  
  1595  done:
  1596          pdata->asd_sizes[0] = i;
                ^^^^^^^^^^^^^^^^
Dereference.

  1597          pdata->subdev_count = i;
  1598          pdata->card_name = "DA850/OMAP-L138 Video Capture";
  1599  
  1600          return pdata;
  1601  }

regards,
dan carpenter

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

* Re: [bug report] [media] davinci: vpif_capture: get subdevs from DT when available
  2017-07-11 13:08 [bug report] [media] davinci: vpif_capture: get subdevs from DT when available Dan Carpenter
@ 2017-07-11 19:09 ` Kevin Hilman
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Hilman @ 2017-07-11 19:09 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-media

Dan Carpenter <dan.carpenter@oracle.com> writes:

> Hello Kevin Hilman,
>
> The patch 4a5f8ae50b66: "[media] davinci: vpif_capture: get subdevs
> from DT when available" from Jun 6, 2017, leads to the following
> static checker warning:
>
> 	drivers/media/platform/davinci/vpif_capture.c:1596 vpif_capture_get_pdata()
> 	error: potential NULL dereference 'pdata'.
>
> drivers/media/platform/davinci/vpif_capture.c
>   1576  
>   1577                  dev_dbg(&pdev->dev, "Remote device %s, %s found\n",
>   1578                          rem->name, rem->full_name);
>   1579                  sdinfo->name = rem->full_name;
>   1580  
>   1581                  pdata->asd[i] = devm_kzalloc(&pdev->dev,
>   1582                                               sizeof(struct v4l2_async_subdev),
>   1583                                               GFP_KERNEL);
>   1584                  if (!pdata->asd[i]) {
>   1585                          of_node_put(rem);
>   1586                          pdata = NULL;
>                                 ^^^^^^^^^^^^
> Set to NULL
>
>   1587                          goto done;
>   1588                  }
>   1589  
>   1590                  pdata->asd[i]->match_type = V4L2_ASYNC_MATCH_FWNODE;
>   1591                  pdata->asd[i]->match.fwnode.fwnode = of_fwnode_handle(rem);
>   1592                  of_node_put(rem);
>   1593          }
>   1594  
>   1595  done:
>   1596          pdata->asd_sizes[0] = i;
>                 ^^^^^^^^^^^^^^^^
> Dereference.
>
>   1597          pdata->subdev_count = i;
>   1598          pdata->card_name = "DA850/OMAP-L138 Video Capture";
>   1599  
>   1600          return pdata;
>   1601  }
>

Thanks for the bug report.  Fix submitted:
https://patchwork.linuxtv.org/patch/42433/

Kevin

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

end of thread, other threads:[~2017-07-11 19:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-11 13:08 [bug report] [media] davinci: vpif_capture: get subdevs from DT when available Dan Carpenter
2017-07-11 19:09 ` Kevin Hilman

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