scsi: hpsa: simplify hpsa_set_local_logical_count()
Subsystems (2)
PATCH 1/1 scsi: hpsa: simplify hpsa_set_local_logical_count()
Variable configured_logical_drive_count is defined as u8 and thus the nested if statement always evaluates to true. Remove it and simplify.
--- drivers/scsi/hpsa.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/scsi/hpsa.c +1 -8
@@ -4090,14 +4090,7 @@ static int hpsa_set_local_logical_count(struct ctlr_info *h, }memset (id_ctlr,0 ,sizeof (*id_ctlr)); rc =hpsa_bmic_id_controller (h, id_ctlr,sizeof (*id_ctlr)); -if (!rc) -if (id_ctlr->configured_logical_drive_count <256 ) - *nlocals = id_ctlr->configured_logical_drive_count; -else - *nlocals =le16_to_cpu ( - id_ctlr->extended_logical_unit_count); -else - *nlocals =-1 ; + *nlocals = rc ?-1 : id_ctlr->configured_logical_drive_count;return rc; }
Signature · 1 line
2.7.4
A message that is not in the archive (sent off-list or not yet received): 4993A297653ECB4581FA5C3C31323D19672184FC@avsrvexchmbx2.microsemi.net
Quoted 50 lines · Don Brace
Quoted 33 lines
-----Original Message-----
From: Christos Gkekas [mailto:[email protected]]
Sent: Sunday, October 15, 2017 2:35 PM
To: Don Brace <[email protected]>; James E.J. Bottomley <[email protected]>; Martin K. Petersen <[email protected]>; esc.storagedev <[email protected]>; [email protected]; linux- [email protected]
Cc: Christos Gkekas <[email protected]>
Subject: [PATCH] scsi: hpsa: simplifyhpsa_set_local_logical_count()EXTERNAL EMAIL
Variable
configured_logical_drive_countis defined as u8 and thus the nested if statement always evaluates to true. Remove it and simplify.Signed-off-by Christos Gkekas <[email protected]>--- drivers/scsi/hpsa.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)drivers/scsi/hpsa.c +0
-1@@ -4090,14 +4090,7 @@ static int hpsa_set_local_logical_count(struct ctlr_info *h, }memset (id_ctlr,0 ,sizeof (*id_ctlr)); rc =hpsa_bmic_id_controller (h, id_ctlr,sizeof (*id_ctlr)); -if (!rc)drivers/scsi/hpsa.c static int hpsa_set_local_logical_count(struct · line 4096
Quoted 10 lines
drivers/scsi/hpsa.c +1
-7-if (id_ctlr->configured_logical_drive_count <256 ) - *nlocals = id_ctlr->configured_logical_drive_count; -else - *nlocals =le16_to_cpu ( - id_ctlr->extended_logical_unit_count); - else - *nlocals =-1 ; + *nlocals = rc ?-1 : id_ctlr->configured_logical_drive_count;return rc; }Thanks for your attention to the hpsa driver.
The actual check should be:
- if (id_ctlr->configured_logical_drive_count< 255)
We need to returnid_ctlr->extended_logical_unit_countotherwise.
Quoted 11 lines
Good catch.
Thanks,
Don Brace
ESC - Smart Storage
Microsemi CorporationQuoted 2 lines
--
2.7.4
Thanks for reviewing this change, will send an updated patch today.
Thanks,
Christos