[PATCH] scsi: scsi_ioctl:drop needless assignment in sg_io()

Lukas Bulwahn posted 1 patch 4 years, 3 months ago
drivers/scsi/scsi_ioctl.c | 1 -
1 file changed, 1 deletion(-)
[PATCH] scsi: scsi_ioctl:drop needless assignment in sg_io()
Posted by Lukas Bulwahn 4 years, 3 months ago
Commit ce70fd9a551a ("scsi: core: Remove the cmd field from struct
scsi_request") refactored sg_io(), so that it does not allocate directly
and hence does not return -ENOMEM in its error case. That makes a
remaining assignment of -ENOMEM to the return variable needless.

Drop this needless assignment in sg_io().

No functional change. No change in resulting object code.

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
---
Christoph, please ack.

Martin, please pick this minor clean-up on your -next tree on top of the
commit above.

 drivers/scsi/scsi_ioctl.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
index 0613015cae39..a480c4d589f5 100644
--- a/drivers/scsi/scsi_ioctl.c
+++ b/drivers/scsi/scsi_ioctl.c
@@ -434,7 +434,6 @@ static int sg_io(struct scsi_device *sdev, struct sg_io_hdr *hdr, fmode_t mode)
 	if (hdr->flags & SG_FLAG_Q_AT_HEAD)
 		at_head = 1;
 
-	ret = -ENOMEM;
 	rq = scsi_alloc_request(sdev->request_queue, writing ?
 			     REQ_OP_DRV_OUT : REQ_OP_DRV_IN, 0);
 	if (IS_ERR(rq))
-- 
2.17.1
Re: [PATCH] scsi: scsi_ioctl:drop needless assignment in sg_io()
Posted by Christoph Hellwig 4 years, 3 months ago
On Tue, Mar 15, 2022 at 07:15:20AM +0100, Lukas Bulwahn wrote:
> Commit ce70fd9a551a ("scsi: core: Remove the cmd field from struct
> scsi_request") refactored sg_io(), so that it does not allocate directly
> and hence does not return -ENOMEM in its error case. That makes a
> remaining assignment of -ENOMEM to the return variable needless.
> 
> Drop this needless assignment in sg_io().
> 
> No functional change. No change in resulting object code.
> 
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Re: [PATCH] scsi: scsi_ioctl:drop needless assignment in sg_io()
Posted by Martin K. Petersen 4 years, 3 months ago
Lukas,

> Commit ce70fd9a551a ("scsi: core: Remove the cmd field from struct
> scsi_request") refactored sg_io(), so that it does not allocate
> directly and hence does not return -ENOMEM in its error case. That
> makes a remaining assignment of -ENOMEM to the return variable
> needless.

Applied to 5.18/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering
Re: [PATCH] scsi: scsi_ioctl:drop needless assignment in sg_io()
Posted by Martin K. Petersen 4 years, 3 months ago
On Tue, 15 Mar 2022 07:15:20 +0100, Lukas Bulwahn wrote:

> Commit ce70fd9a551a ("scsi: core: Remove the cmd field from struct
> scsi_request") refactored sg_io(), so that it does not allocate directly
> and hence does not return -ENOMEM in its error case. That makes a
> remaining assignment of -ENOMEM to the return variable needless.
> 
> Drop this needless assignment in sg_io().
> 
> [...]

Applied to 5.18/scsi-queue, thanks!

[1/1] scsi: scsi_ioctl:drop needless assignment in sg_io()
      https://git.kernel.org/mkp/scsi/c/66daf3e6b993

-- 
Martin K. Petersen	Oracle Linux Engineering