summaryrefslogtreecommitdiffstats
path: root/drivers/misc/cxl/vphb.c
diff options
context:
space:
mode:
authorManinder Singh <maninder1.s@samsung.com>2015-06-29 16:05:11 +0530
committerMichael Ellerman <mpe@ellerman.id.au>2015-07-06 20:24:34 +1000
commit14f21189df33bc972455d6a0ed875aa68718d7fc (patch)
tree7df8aa74414d6d9a2dce0436d4c3af4907ea3433 /drivers/misc/cxl/vphb.c
parentd8ea782b56d9d2c46a47b3231cfd16ecfb538c60 (diff)
downloadlinux-14f21189df33bc972455d6a0ed875aa68718d7fc.tar.gz
linux-14f21189df33bc972455d6a0ed875aa68718d7fc.tar.bz2
linux-14f21189df33bc972455d6a0ed875aa68718d7fc.zip
cxl/vphb.c: Use phb pointer after NULL check
static Anlaysis detected below error:- (error) Possible null pointer dereference: phb So, Use phb after NULL check. Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Acked-by: Ian Munsie <imunsie@au1.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'drivers/misc/cxl/vphb.c')
-rw-r--r--drivers/misc/cxl/vphb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/misc/cxl/vphb.c b/drivers/misc/cxl/vphb.c
index b1d1983a84a5..2eba002b580b 100644
--- a/drivers/misc/cxl/vphb.c
+++ b/drivers/misc/cxl/vphb.c
@@ -112,9 +112,10 @@ static int cxl_pcie_config_info(struct pci_bus *bus, unsigned int devfn,
unsigned long addr;
phb = pci_bus_to_host(bus);
- afu = (struct cxl_afu *)phb->private_data;
if (phb == NULL)
return PCIBIOS_DEVICE_NOT_FOUND;
+ afu = (struct cxl_afu *)phb->private_data;
+
if (cxl_pcie_cfg_record(bus->number, devfn) > afu->crs_num)
return PCIBIOS_DEVICE_NOT_FOUND;
if (offset >= (unsigned long)phb->cfg_data)