All of lore.kernel.org
 help / color / mirror / Atom feed
From: Deepak R Varma <drv@mailo.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	Jonathan Cameron <jic23@kernel.org>,
	linux-iio@vger.kernel.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: iio: meter: use min() for comparison and assignment
Date: Tue, 8 Nov 2022 21:06:24 +0530	[thread overview]
Message-ID: <Y2p3eIQjdyBWs1xD@ubunlion> (raw)
In-Reply-To: <Y2px0THYSMaU4gyZ@kroah.com>

On Tue, Nov 08, 2022 at 04:12:17PM +0100, Greg Kroah-Hartman wrote:
> On Mon, Nov 07, 2022 at 09:40:00AM +0530, Deepak R Varma wrote:
> > Simplify code by using recommended min helper macro for logical
> > evaluation and value assignment. This issue is identified by
> > coccicheck using the minmax.cocci file.
> >
> > Signed-off-by: Deepak R Varma <drv@mailo.com>
> > ---
> >  drivers/staging/iio/meter/ade7854-i2c.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c
> > index a9a06e8dda51..a6ce7b24cc8f 100644
> > --- a/drivers/staging/iio/meter/ade7854-i2c.c
> > +++ b/drivers/staging/iio/meter/ade7854-i2c.c
> > @@ -61,7 +61,7 @@ static int ade7854_i2c_write_reg(struct device *dev,
> >  unlock:
> >  	mutex_unlock(&st->buf_lock);
> >
> > -	return ret < 0 ? ret : 0;
> > +	return min(ret, 0);
>
> As others have said, this isn't ok, and I hate ? : usage, so if you
> want, spell that out please.

Hello Greg,
Just want to make sure I am getting it right:
Are you suggesting me to resubmit the patch with revised patch description?

Should I consider using the "if" based evaluation rather than using min() macro?

Thank you,
./drv

>
> thanks,
>
> greg k-h
>



  reply	other threads:[~2022-11-08 15:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07  4:10 [PATCH] staging: iio: meter: use min() for comparison and assignment Deepak R Varma
2022-11-07 13:08 ` Dan Carpenter
2022-11-07 15:15   ` Deepak R Varma
2022-11-07 15:22   ` Joe Perches
2022-11-07 15:38     ` Dan Carpenter
2022-11-07 16:27       ` Deepak R Varma
2022-11-08 15:12 ` Greg Kroah-Hartman
2022-11-08 15:36   ` Deepak R Varma [this message]
2022-11-12 16:35     ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y2p3eIQjdyBWs1xD@ubunlion \
    --to=drv@mailo.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.