mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
scsi: core: scsi_get_device_flags_keyed(): Always return device flags
[ Upstream commita44c9d3650] Since scsi_get_device_flags_keyed() callers do not check whether or not the returned value is an error code, change that function such that it returns a flags value even if the 'key' argument is invalid. Note: since commit28a0bc4120("scsi: sd: Implement blacklist option for WRITE SAME w/ UNMAP") bit 31 is a valid device information flag so checking whether bit 31 is set in the return value is not sufficient to tell the difference between an error code and a flags value. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.com> Cc: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c3dec92f3d
commit
f2e152e2b0
@@ -596,17 +596,12 @@ int scsi_get_device_flags_keyed(struct scsi_device *sdev,
|
||||
int key)
|
||||
{
|
||||
struct scsi_dev_info_list *devinfo;
|
||||
int err;
|
||||
|
||||
devinfo = scsi_dev_info_list_find(vendor, model, key);
|
||||
if (!IS_ERR(devinfo))
|
||||
return devinfo->flags;
|
||||
|
||||
err = PTR_ERR(devinfo);
|
||||
if (err != -ENOENT)
|
||||
return err;
|
||||
|
||||
/* nothing found, return nothing */
|
||||
/* key or device not found: return nothing */
|
||||
if (key != SCSI_DEVINFO_GLOBAL)
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user