Re: [PATCH] staging: iio: meter: use min() for comparison and assignment

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

 



On Mon, Nov 07, 2022 at 06:38:35PM +0300, Dan Carpenter wrote:
> On Mon, Nov 07, 2022 at 07:22:24AM -0800, Joe Perches wrote:
> > > In terms of run time, this patch is fine but in terms of reading the
> > > code using min() makes it less readable.
> >
> > It's not a runtime question, either should compile to the same object
> > code.  It's definitely a readabiity and standardization issue.
> >
> > In this case, IMO it'd be better to use the much more common
> >
> > 	if (ret < 0)
> > 		return ret;
> >
> > 	return 0;
>
> I also prefer this format.
>
> But at the same time, I can't advise Deepak to go around changing
> existing code where the author like ternaries.

Thank you Joe, Dan. Just to conclude, I will leave the line untouched as it is
no big advantage and the current format is more readable.

./drv

>
> regards,
> dan carpenter
>





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux