Skip to content

Commit 79d45f5

Browse files
bulwahnaxboe
authored andcommitted
sr: simplify the local variable initialization in sr_block_open()
Commit 01d0c69 ("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. Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20220314150321.17720-1-lukas.bulwahn@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 6b2b045 commit 79d45f5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/scsi/sr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,9 @@ static void sr_revalidate_disk(struct scsi_cd *cd)
483483

484484
static int sr_block_open(struct block_device *bdev, fmode_t mode)
485485
{
486-
struct scsi_cd *cd = cd = scsi_cd(bdev->bd_disk);
486+
struct scsi_cd *cd = scsi_cd(bdev->bd_disk);
487487
struct scsi_device *sdev = cd->device;
488-
int ret = -ENXIO;
488+
int ret;
489489

490490
if (scsi_device_get(cd->device))
491491
return -ENXIO;

0 commit comments

Comments
 (0)