summaryrefslogtreecommitdiffstats
path: root/platforms/ibm-fsp/lxvpd.c
diff options
context:
space:
mode:
authorSuraj Jitindar Singh <sjitindarsingh@gmail.com>2016-07-19 11:18:25 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-07-28 13:42:50 +1000
commitaf225a8ddd3e058da59becf2129e840475b70e27 (patch)
treebdf9aa309dc7446ede5b1e73e4857cad3c1b37d6 /platforms/ibm-fsp/lxvpd.c
parent95ba2af20d232dcab3f923f0f509684f4767ab3c (diff)
downloadtalos-skiboot-af225a8ddd3e058da59becf2129e840475b70e27.tar.gz
talos-skiboot-af225a8ddd3e058da59becf2129e840475b70e27.zip
platforms/ibm-fsp: Fix incorrect struct member access and comparison
For a 1004 slot mapping bit 6 (0x40) of the P0 field represents the pwr_ctl bit. This code previously accessed the wrong field (power_ctl) which is a single bit which corresponds to the 1005 mapping (which is the wrong mapping), performed a bitwise and with 0x40 (which will always be 0), and then compared to 1 (which will also always be 0). Fix this to access the byte struct member, bitwise and with 0x40 to mask the power_ctl bit, and double negate to guarantee 0 or 1 result. Fixes: Coverity Bug #97820 Fixes: 6884fe63 ("platforms/ibm-fsp: Support PCI slot") Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Acked-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'platforms/ibm-fsp/lxvpd.c')
-rw-r--r--platforms/ibm-fsp/lxvpd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/platforms/ibm-fsp/lxvpd.c b/platforms/ibm-fsp/lxvpd.c
index 78e709c1..72512b7f 100644
--- a/platforms/ibm-fsp/lxvpd.c
+++ b/platforms/ibm-fsp/lxvpd.c
@@ -207,7 +207,7 @@ static void lxvpd_parse_1004_map(struct phb *phb,
s->vswitch_id = entry->pba & 0xf;
s->dev_id = entry->sba;
s->pluggable = ((entry->p0.byte & 0x20) == 0);
- s->power_ctl = ((entry->p0.power_ctl & 0x40) == 1);
+ s->power_ctl = !!(entry->p0.byte & 0x40);
s->bus_clock = entry->p2.bus_clock - 4;
s->connector_type = entry->p2.connector_type - 5;
s->card_desc = entry->p3.byte >> 6;
OpenPOWER on IntegriCloud