diff mbox series

[03/10] scsi/sr: use blk_cleanup_disk() instead of put_disk()

Message ID 20210823202930.137278-4-mcgrof@kernel.org
State New
Headers show
Series block: first batch of add_disk() error handling conversions | expand

Commit Message

Luis Chamberlain Aug. 23, 2021, 8:29 p.m. UTC
The single put_disk() is useful if you know you're not doing
a cleanup after add_disk(), but since we want to add support
for that, just use the normal form of blk_cleanup_disk() to
cleanup the queue and put the disk.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 drivers/scsi/sr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig Aug. 24, 2021, 6 a.m. UTC | #1
On Mon, Aug 23, 2021 at 01:29:23PM -0700, Luis Chamberlain wrote:
> The single put_disk() is useful if you know you're not doing

> a cleanup after add_disk(), but since we want to add support

> for that, just use the normal form of blk_cleanup_disk() to

> cleanup the queue and put the disk.

> 

> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>


.. not needed as the cleanup is done by the core scsi code.
Luis Chamberlain Aug. 27, 2021, 6:28 p.m. UTC | #2
On Tue, Aug 24, 2021 at 07:00:27AM +0100, Christoph Hellwig wrote:
> On Mon, Aug 23, 2021 at 01:29:23PM -0700, Luis Chamberlain wrote:

> > The single put_disk() is useful if you know you're not doing

> > a cleanup after add_disk(), but since we want to add support

> > for that, just use the normal form of blk_cleanup_disk() to

> > cleanup the queue and put the disk.

> > 

> > Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

> 

> .. not needed as the cleanup is done by the core scsi code.


Dropped.

  Luis
diff mbox series

Patch

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index a0df27db4d61..dc78ad96e6f9 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -792,7 +792,7 @@  static int sr_probe(struct device *dev)
 	clear_bit(minor, sr_index_bits);
 	spin_unlock(&sr_index_lock);
 fail_put:
-	put_disk(disk);
+	blk_cleanup_disk(disk);
 	mutex_destroy(&cd->lock);
 fail_free:
 	kfree(cd);