Re: [PATCH v7 1/1] gpio: add sloppy logic analyzer using polling

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

 



On Mon, Mar 28, 2022 at 11:37:32AM +0200, Wolfram Sang wrote:

> > > +	mutex_lock(&priv->lock);
> > > +
> > > +	vfree(priv->blob.data);
> > 
> > 	priv->blob.data = NULL;
> > 	priv->blob.size = 0;
> > 
> > > +	p = vzalloc(val);
> > > +	if (!p) {
> > > +		val = 0;
> > > +		ret = -ENOMEM;
> > > +	}
> > 
> > 	p = vzalloc(val);
> > 	if (!p)
> > 		return -ENOMEM;
> > 
> > > +	priv->blob.data = p;
> > > +	priv->blob.size = val;
> 
> I don't like assigning 'priv' memebers twice, so I'd like to keep it as
> is.

But this will give better understanding of the steps the code performs, no?
(Because this function basically contains two steps at once. I assume it's
 done this way due to absence of vrealloc(), right?)

But we have kvrealloc(). Can it be used here?

...

> > Can it be wrapped by DEFINE_SHOW_ATTRIBUTE()?
> 
> I don't see a way. Do you?

Me neither. I mixed this up with (not upstreamed yet) DEFINE_STORE_ATTRIBUTE.

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux