Skip to contentSkip to conversation

sr: simplify the local variable initialization in sr_block_open()

PATCH Applied Lukas Bulwahn 3 participants 5 messages Mar 14, 2022 – Mar 15, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sr: simplify the local variable initialization in sr_block_open()

Commit 01d0c698536f ("sr: implement ->free_disk to simplify refcounting") refactored sr_block_open(), initialized one variable with a duplicate assignment (probably an unintended copy & paste duplication) and turned one error case into an early return, which makes the initialization of the return variable needless.

So, simplify the local variable initialization in sr_block_open() to make the code a bit more clear.

No functional change. No change in resulting object code.

---
Christoph, please ack.

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

 drivers/scsi/sr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/sr.c +2 -2
index 00142095522a..5ba9df334968 100644
@@ -483,9 +483,9 @@ static void sr_revalidate_disk(struct scsi_cd *cd)
 
 static int sr_block_open(struct block_device *bdev, fmode_t mode)
 {
-	struct scsi_cd *cd = cd = scsi_cd(bdev->bd_disk);
+	struct scsi_cd *cd = scsi_cd(bdev->bd_disk);
 	struct scsi_device *sdev = cd->device;
-	int ret = -ENXIO;
+	int ret;
 
 	if (scsi_device_get(cd->device))
 		return -ENXIO;
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 9 lines · Lukas Bulwahn

Commit 01d0c698536f ("sr: implement ->free_disk to simplify refcounting") refactored sr_block_open(), initialized one variable with a duplicate assignment (probably an unintended copy & paste duplication) and turned one error case into an early return, which makes the initialization of the return variable needless.

So, simplify the local variable initialization in sr_block_open() to make the code a bit more clear.

Quoted 8 lines

No functional change. No change in resulting object code.

---
Christoph, please ack.

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

Should it have a Fixes line?

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 13 lines · Jens Axboe
Quoted 11 lines · Lukas Bulwahn

Commit 01d0c698536f ("sr: implement ->free_disk to simplify refcounting") refactored sr_block_open(), initialized one variable with a duplicate assignment (probably an unintended copy & paste duplication) and turned one error case into an early return, which makes the initialization of the return variable needless.

So, simplify the local variable initialization in sr_block_open() to make the code a bit more clear.

No functional change. No change in resulting object code.

Quoted 9 lines
Quoted 6 lines

---
Christoph, please ack.

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

Should it have a Fixes line?

As it is really just syntactic clean-up, it does not deserve the attention for any kind of severity assessment or potential backporting, which usually comes with a Fixes: tag.

So, I personally do not consider a Fixes: tag needed. The code works well before this patch, and well after this patch; it is just a bit more clear now.

Lukas

Quoted 3 lines

--
Jens Axboe

Reviewed-by on v1 1/1
#3 lore raw
In reply to Lukas Bulwahn
Quoted 9 lines · Lukas Bulwahn

Commit 01d0c698536f ("sr: implement ->free_disk to simplify refcounting") refactored sr_block_open(), initialized one variable with a duplicate assignment (probably an unintended copy & paste duplication) and turned one error case into an early return, which makes the initialization of the return variable needless.

So, simplify the local variable initialization in sr_block_open() to make the code a bit more clear.

Quoted 8 lines

No functional change. No change in resulting object code.

---
Christoph, please ack.

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

Looks good:

maintainer Applied
#4 lore raw
In reply to Lukas Bulwahn
Quoted 10 lines · Lukas Bulwahn

Commit 01d0c698536f ("sr: implement ->free_disk to simplify refcounting") refactored sr_block_open(), initialized one variable with a duplicate assignment (probably an unintended copy & paste duplication) and turned one error case into an early return, which makes the initialization of the return variable needless.

So, simplify the local variable initialization in sr_block_open() to make the code a bit more clear.

[...]

Applied, thanks!

[1/1] sr: simplify the local variable initialization in sr_block_open()

      commit: 79d45f57a19537a1ec6ebf836944e968b154f86e

Best regards,

Signature · 1 line
Jens Axboe