linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Amelie DELAUNAY <amelie.delaunay@st.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 2/2] usb: typec: stusb160x: fix some signedness bugs
Date: Wed, 28 Oct 2020 16:23:46 +0300	[thread overview]
Message-ID: <20201028132346.GP18329@kadam> (raw)
In-Reply-To: <625bf21d-e3bb-f952-9368-d93bee05a461@st.com>

On Wed, Oct 28, 2020 at 01:26:16PM +0100, Amelie DELAUNAY wrote:
> > @@ -567,9 +567,10 @@ static int stusb160x_get_fw_caps(struct stusb160x *chip,
> >   	if (!ret) {
> >   		chip->pwr_opmode = typec_find_pwr_opmode(cap_str);
> >   		/* Power delivery not yet supported */
> > -		if (chip->pwr_opmode < 0 ||
> > +		if ((int)chip->pwr_opmode < 0 ||
> >   		    chip->pwr_opmode == TYPEC_PWR_MODE_PD) {
> > -			ret = chip->pwr_opmode < 0 ? chip->pwr_opmode : -EINVAL;
> > +			ret = (int)chip->pwr_opmode < 0 ? chip->pwr_opmode :
> > +							  -EINVAL;
> >   			dev_err(chip->dev, "bad power operation mode: %d\n",
> >   				chip->pwr_opmode);
> >   			return ret;
> > 
> 
> 	if (!ret) {
> 		ret = typec_find_pwr_opmode(cap_str);
> 		/* Power delivery not yet supported */
> 		if (ret < 0 || ret == TYPEC_PWR_MODE_PD) {
> 			dev_err(chip->dev, "bad power operation mode: %d\n", ret);
> 			return -EINVAL;
> 		}
> 		chip->pwr_opmode = ret;
> 	}
> 
> 
> So, which fix sounds better ? IMHO using ret make the code more readable.

Yeah.  Your patch is nicer, but Greg *just* merged mine so it might
be too late...

regards,
dan carpenter


  reply	other threads:[~2020-10-28 21:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-23 11:24 [PATCH 2/2] usb: typec: stusb160x: fix some signedness bugs Dan Carpenter
2020-10-28 12:26 ` Amelie DELAUNAY
2020-10-28 13:23   ` Dan Carpenter [this message]
2020-10-28 14:38     ` Amelie DELAUNAY
2020-10-28 15:40       ` Greg Kroah-Hartman
2020-10-29  8:21   ` AW: " Walter Harms

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=20201028132346.GP18329@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=amelie.delaunay@st.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).