Re: [PATCH 2/2] usb: typec: stusb160x: fix some signedness bugs

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

 



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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux