Re: [PATCH v7 1/1] gpio: add sloppy logic analyzer using polling
From: Andy Shevchenko
Date: Mon Mar 28 2022 - 06:50:30 EST
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