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

From: Dan Carpenter
Date: Mon Nov 07 2022 - 10:38:47 EST


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.

regards,
dan carpenter