[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZsiUNodqp9PgzbP-@smile.fi.intel.com>
Date: Fri, 23 Aug 2024 16:52:54 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Chen-Yu Tsai <wenst@...omium.org>
Cc: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Wolfram Sang <wsa@...nel.org>, Benson Leung <bleung@...omium.org>,
Tzung-Bi Shih <tzungbi@...nel.org>, Mark Brown <broonie@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>,
chrome-platform@...ts.linux.dev, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
Douglas Anderson <dianders@...omium.org>,
Johan Hovold <johan@...nel.org>, Jiri Kosina <jikos@...nel.org>,
linux-i2c@...r.kernel.org
Subject: Re: [PATCH v5 06/10] i2c: Introduce OF component probe function
On Fri, Aug 23, 2024 at 04:40:36PM +0800, Chen-Yu Tsai wrote:
> On Thu, Aug 22, 2024 at 10:02 PM Andy Shevchenko
> <andriy.shevchenko@...ux.intel.com> wrote:
> > On Thu, Aug 22, 2024 at 05:19:59PM +0800, Chen-Yu Tsai wrote:
...
> > > + ret = of_changeset_apply(ocs);
> > > + if (!ret) {
> >
> > Why not positive conditional?
>
> No real reason. I suppose having the error condition come first is more
> common.
Yes, when you have something like
if (err) {
...
return err;
} else {
...
}
But you don't. That's why I commented on this.
> Not sure if it makes any difference in this case though?
! is hard to read by a human being, easy to make a mistake in the brain of
reader and with inverted logic the code reading becomes harder. So, it's pure
about cognitive function.
> > > + /*
> > > + * ocs is intentionally kept around as it needs to
> > > + * exist as long as the change is applied.
> > > + */
> > > + void *ptr __always_unused = no_free_ptr(ocs);
> > > + } else {
> > > + /* ocs needs to be explicitly cleaned up before being freed. */
> > > + of_changeset_destroy(ocs);
> > > + }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists