Message ID | 20170717220116.17886-7-sakari.ailus@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Sakari, Thank you for the patch. On Tuesday 18 Jul 2017 01:01:15 Sakari Ailus wrote: > Put the last endpoint fwnode if there are too many endpoints to handle. > Also tell the user about about the condition. > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> There are so many refcount-related issues with fwnodes, I wonder whether we could/should teach a static analyzer about that. > --- > drivers/media/platform/omap3isp/isp.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/platform/omap3isp/isp.c > b/drivers/media/platform/omap3isp/isp.c index 4e6ba7f90e35..13a8ce4de18b > 100644 > --- a/drivers/media/platform/omap3isp/isp.c > +++ b/drivers/media/platform/omap3isp/isp.c > @@ -2154,11 +2154,16 @@ static int isp_fwnodes_parse(struct device *dev, > if (!notifier->subdevs) > return -ENOMEM; > > - while (notifier->num_subdevs < ISP_MAX_SUBDEVS && > - (fwnode = fwnode_graph_get_next_endpoint( > - of_fwnode_handle(dev->of_node), fwnode))) { > + while ((fwnode = fwnode_graph_get_next_endpoint(dev_fwnode(dev), > + fwnode))) { > struct isp_async_subdev *isd; > > + if (notifier->num_subdevs >= ISP_MAX_SUBDEVS) { > + dev_warn(dev, "too many endpoints, ignoring\n"); > + fwnode_handle_put(fwnode); > + break; > + } > + > isd = devm_kzalloc(dev, sizeof(*isd), GFP_KERNEL); > if (!isd) > goto error;
On Tue, Jul 18, 2017 at 11:40:22AM +0300, Laurent Pinchart wrote: > Hi Sakari, > > Thank you for the patch. > > On Tuesday 18 Jul 2017 01:01:15 Sakari Ailus wrote: > > Put the last endpoint fwnode if there are too many endpoints to handle. > > Also tell the user about about the condition. > > > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > There are so many refcount-related issues with fwnodes, I wonder whether we > could/should teach a static analyzer about that. This will be actually soon replaced by a convenience function in the frameworks in my recent RFC patchset. I'll drop this patch (as I'll do the first one).
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 4e6ba7f90e35..13a8ce4de18b 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -2154,11 +2154,16 @@ static int isp_fwnodes_parse(struct device *dev, if (!notifier->subdevs) return -ENOMEM; - while (notifier->num_subdevs < ISP_MAX_SUBDEVS && - (fwnode = fwnode_graph_get_next_endpoint( - of_fwnode_handle(dev->of_node), fwnode))) { + while ((fwnode = fwnode_graph_get_next_endpoint(dev_fwnode(dev), + fwnode))) { struct isp_async_subdev *isd; + if (notifier->num_subdevs >= ISP_MAX_SUBDEVS) { + dev_warn(dev, "too many endpoints, ignoring\n"); + fwnode_handle_put(fwnode); + break; + } + isd = devm_kzalloc(dev, sizeof(*isd), GFP_KERNEL); if (!isd) goto error;
Put the last endpoint fwnode if there are too many endpoints to handle. Also tell the user about about the condition. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> --- drivers/media/platform/omap3isp/isp.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)