Re: [PATCH v5 06/10] i2c: Introduce OF component probe function

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

 



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@xxxxxxxxxxxxxxx> 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






[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