Re: [PATCH v1] scsi: ufs: use an generic error code in ufshcd_set_dev_pwr_mode

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

 



On 1/19/22 18:51, Kiwoong Kim wrote:
@@ -8669,6 +8669,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba
*hba,
   			    pwr_mode, ret);
   		if (ret > 0 && scsi_sense_valid(&sshdr))
   			scsi_print_sense_hdr(sdp, NULL, &sshdr);
+		ret = -EIO;
   	}

   	if (!ret)

Shouldn't "ret = -EIO" only be executed if ret > 0? Additionally, please
update the documentation of ufshcd_set_dev_pwr_mode(). I'm referring to
the following comment: "Returns non-zero if failed to set the requested
power mode".

Thanks,

Bart.

scsi_execute returns cmd->result(int type) but I think there is no case that the valaue is negative
because all values defined for its most significant byte, i.e. driver byte, are smaller than 0x80.
And I understand the 'ret > 0' presents that something wrong happens during the process.

So I'm not sure if 'ret = -EIO;' should be executed under 'ret > 0'.

I think that scsi_execute() can return a negative value. From __scsi_execute():

	req = scsi_alloc_request(sdev->request_queue,
			data_direction == DMA_TO_DEVICE ?
			REQ_OP_DRV_OUT : REQ_OP_DRV_IN,
			rq_flags & RQF_PM ? BLK_MQ_REQ_PM : 0);
	if (IS_ERR(req))
		return PTR_ERR(req);

As you probably know PTR_ERR() returns a negative error code if IS_ERR() returns true.

Thanks,

Bart.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux