Re: [PATCH v12 06/19] media: v4l2-fwnode: add initial connector parsing support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20-03-11 11:03, Sakari Ailus wrote:
> On Wed, Mar 11, 2020 at 09:43:57AM +0100, Marco Felsch wrote:
> > Hi Sakari,
> > 
> > On 20-03-11 10:17, Sakari Ailus wrote:
> > > Hi Marco,
> > > 
> > > On Mon, Mar 09, 2020 at 11:14:15AM +0100, Marco Felsch wrote:
> > > ...
> > > > +void v4l2_fwnode_connector_free(struct v4l2_fwnode_connector *connector)
> > > > +{
> > > > +	struct v4l2_connector_link *link, *tmp;
> > > > +
> > > > +	if (IS_ERR_OR_NULL(connector) ||
> > > > +	    connector->type == V4L2_CONN_UNKNOWN)
> > > > +		return;
> > > > +
> > > > +	list_for_each_entry_safe(link, tmp, &connector->links, head) {
> > > > +		v4l2_fwnode_put_link(&link->fwnode_link);
> > > > +		list_del(&link->head);
> > > > +		kfree(link);
> > > > +	}
> > > > +
> > > > +	kfree(connector->label);
> > > > +	connector->label = NULL;
> > > > +	connector = NULL;
> > > 
> > > No need to set connector NULL here.
> > 
> > My intention was to make it safe e.g. if a caller calls this twice for
> > the same connector.
> 
> This changes the pointer to NULL locally but the caller won't see this ---
> because it's the value of the pointer that was passed here by the caller.

Argh, you're right. Damn i missed this.

Regards,
  Marco



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux