From: Hannes Reinecke Date: Tue, 27 Apr 2021 08:30:08 +0000 (+0200) Subject: scsi: scsi_ioctl: Return error code when blk_rq_map_kern() fails X-Git-Tag: accepted/tizen/unified/20230118.172025~6832^2~133^2~38 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=21eccf304b3a16c26fc2878faca4665907a318ec;p=platform%2Fkernel%2Flinux-rpi.git scsi: scsi_ioctl: Return error code when blk_rq_map_kern() fails The callers of sg_scsi_ioctl() already check for negative return values, so we can drop the usage of DRIVER_ERROR and return the error from blk_rq_map_kern() instead. Link: https://lore.kernel.org/r/20210427083046.31620-3-hare@suse.de Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Signed-off-by: Hannes Reinecke Signed-off-by: Martin K. Petersen --- diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 1b3fe99..48bb4e1 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -484,9 +484,10 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, break; } - if (bytes && blk_rq_map_kern(q, rq, buffer, bytes, GFP_NOIO)) { - err = DRIVER_ERROR << 24; - goto error; + if (bytes) { + err = blk_rq_map_kern(q, rq, buffer, bytes, GFP_NOIO); + if (err) + goto error; } blk_execute_rq(disk, rq, 0);