All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sr: simplify the local variable initialization in sr_block_open()
@ 2022-03-14 15:03 Lukas Bulwahn
  2022-03-14 15:05 ` Jens Axboe
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Lukas Bulwahn @ 2022-03-14 15:03 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe, linux-block
  Cc: James E . J . Bottomley, Martin K . Petersen, linux-scsi,
	linux-kernel, clang-built-linux, kernel-janitors, 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.

Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
---
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(-)

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 00142095522a..5ba9df334968 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] sr: simplify the local variable initialization in sr_block_open()
  2022-03-14 15:03 [PATCH] sr: simplify the local variable initialization in sr_block_open() Lukas Bulwahn
@ 2022-03-14 15:05 ` Jens Axboe
  2022-03-14 15:33   ` Lukas Bulwahn
  2022-03-15  6:30 ` Christoph Hellwig
  2022-03-15 20:42 ` Jens Axboe
  2 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2022-03-14 15:05 UTC (permalink / raw)
  To: Lukas Bulwahn, Christoph Hellwig, linux-block
  Cc: James E . J . Bottomley, Martin K . Petersen, linux-scsi,
	linux-kernel, clang-built-linux, kernel-janitors

On 3/14/22 9:03 AM, Lukas Bulwahn wrote:
> 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.
> 
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> ---
> 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?

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sr: simplify the local variable initialization in sr_block_open()
  2022-03-14 15:05 ` Jens Axboe
@ 2022-03-14 15:33   ` Lukas Bulwahn
  0 siblings, 0 replies; 5+ messages in thread
From: Lukas Bulwahn @ 2022-03-14 15:33 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Christoph Hellwig, linux-block, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi, Linux Kernel Mailing List,
	clang-built-linux, kernel-janitors

On Mon, Mar 14, 2022 at 4:05 PM Jens Axboe <axboe@kernel.dk> wrote:
>
> On 3/14/22 9:03 AM, Lukas Bulwahn wrote:
> > 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.
> >
> > Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> > ---
> > 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

> --
> Jens Axboe
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sr: simplify the local variable initialization in sr_block_open()
  2022-03-14 15:03 [PATCH] sr: simplify the local variable initialization in sr_block_open() Lukas Bulwahn
  2022-03-14 15:05 ` Jens Axboe
@ 2022-03-15  6:30 ` Christoph Hellwig
  2022-03-15 20:42 ` Jens Axboe
  2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2022-03-15  6:30 UTC (permalink / raw)
  To: Lukas Bulwahn
  Cc: Christoph Hellwig, Jens Axboe, linux-block,
	James E . J . Bottomley, Martin K . Petersen, linux-scsi,
	linux-kernel, clang-built-linux, kernel-janitors

On Mon, Mar 14, 2022 at 04:03:21PM +0100, Lukas Bulwahn wrote:
> 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.
> 
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> ---
> Christoph, please ack.
> 
> Jens, please pick this minor clean-up on your -next branch on top of the
> commit above.

Looks good:

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sr: simplify the local variable initialization in sr_block_open()
  2022-03-14 15:03 [PATCH] sr: simplify the local variable initialization in sr_block_open() Lukas Bulwahn
  2022-03-14 15:05 ` Jens Axboe
  2022-03-15  6:30 ` Christoph Hellwig
@ 2022-03-15 20:42 ` Jens Axboe
  2 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2022-03-15 20:42 UTC (permalink / raw)
  To: linux-block, Lukas Bulwahn, Christoph Hellwig
  Cc: James E . J . Bottomley, clang-built-linux, linux-kernel,
	linux-scsi, Martin K . Petersen, kernel-janitors

On Mon, 14 Mar 2022 16:03:21 +0100, Lukas Bulwahn wrote:
> 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,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-15 20:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-14 15:03 [PATCH] sr: simplify the local variable initialization in sr_block_open() Lukas Bulwahn
2022-03-14 15:05 ` Jens Axboe
2022-03-14 15:33   ` Lukas Bulwahn
2022-03-15  6:30 ` Christoph Hellwig
2022-03-15 20:42 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.