[01/39] st: return error code in st_scsi_execute()

Message ID 20210423113944.42672-2-hare@suse.de
State New
Headers show
Series
  • SCSI result cleanup, part 2
Related show

Commit Message

Hannes Reinecke April 23, 2021, 11:39 a.m.
The callers to st_scsi_execute already check for negative
return values, so we can drop the use of DRIVER_ERROR and
return the actual error code.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/st.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Bart Van Assche April 26, 2021, 3:19 a.m. | #1
On 4/23/21 4:39 AM, Hannes Reinecke wrote:
> The callers to st_scsi_execute already check for negative

> return values, so we can drop the use of DRIVER_ERROR and

> return the actual error code.


Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Christoph Hellwig April 26, 2021, 2:51 p.m. | #2
On Fri, Apr 23, 2021 at 01:39:06PM +0200, Hannes Reinecke wrote:
> The callers to st_scsi_execute already check for negative

> return values, so we can drop the use of DRIVER_ERROR and

> return the actual error code.

> 

> Signed-off-by: Hannes Reinecke <hare@suse.de>


Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

Patch

diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 9ca536aae784..23be6447e576 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -551,7 +551,7 @@  static int st_scsi_execute(struct st_request *SRpnt, const unsigned char *cmd,
 			data_direction == DMA_TO_DEVICE ?
 			REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, 0);
 	if (IS_ERR(req))
-		return DRIVER_ERROR << 24;
+		return PTR_ERR(req);
 	rq = scsi_req(req);
 	req->rq_flags |= RQF_QUIET;
 
@@ -562,7 +562,7 @@  static int st_scsi_execute(struct st_request *SRpnt, const unsigned char *cmd,
 				      GFP_KERNEL);
 		if (err) {
 			blk_put_request(req);
-			return DRIVER_ERROR << 24;
+			return err;
 		}
 	}