mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 14:21:47 +00:00
scsi: sg: Fix checking return value of blk_get_queue()
Commitfcaa174a9c
("scsi/sg: don't grab scsi host module reference") make a mess how blk_get_queue() is called, blk_get_queue() returns true on success while the caller expects it returns 0 on success. Fix this problem and also add a corresponding error message on failure. Fixes:fcaa174a9c
("scsi/sg: don't grab scsi host module reference") Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com> Closes: https://lore.kernel.org/all/87lefv622n.fsf@linux.ibm.com/ Signed-off-by: Yu Kuai <yukuai3@huawei.com> Link: https://lore.kernel.org/r/20230705024001.177585-1-yukuai1@huaweicloud.com Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Tested-by: Marc Hartmayer <mhartmay@linux.ibm.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
f4d1a8e011
commit
80b6051085
@ -1497,9 +1497,10 @@ sg_add_device(struct device *cl_dev)
|
||||
int error;
|
||||
unsigned long iflags;
|
||||
|
||||
error = blk_get_queue(scsidp->request_queue);
|
||||
if (error)
|
||||
return error;
|
||||
if (!blk_get_queue(scsidp->request_queue)) {
|
||||
pr_warn("%s: get scsi_device queue failed\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
error = -ENOMEM;
|
||||
cdev = cdev_alloc();
|
||||
|
Loading…
Reference in New Issue
Block a user