diff options
author | Maninder Singh <maninder1.s@samsung.com> | 2015-06-29 06:35:11 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2015-07-06 06:24:34 -0400 |
commit | 14f21189df33bc972455d6a0ed875aa68718d7fc (patch) | |
tree | 7df8aa74414d6d9a2dce0436d4c3af4907ea3433 /drivers/misc/cxl/vphb.c | |
parent | d8ea782b56d9d2c46a47b3231cfd16ecfb538c60 (diff) |
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.c | 3 |
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, | |||
112 | unsigned long addr; | 112 | unsigned long addr; |
113 | 113 | ||
114 | phb = pci_bus_to_host(bus); | 114 | phb = pci_bus_to_host(bus); |
115 | afu = (struct cxl_afu *)phb->private_data; | ||
116 | if (phb == NULL) | 115 | if (phb == NULL) |
117 | return PCIBIOS_DEVICE_NOT_FOUND; | 116 | return PCIBIOS_DEVICE_NOT_FOUND; |
117 | afu = (struct cxl_afu *)phb->private_data; | ||
118 | |||
118 | if (cxl_pcie_cfg_record(bus->number, devfn) > afu->crs_num) | 119 | if (cxl_pcie_cfg_record(bus->number, devfn) > afu->crs_num) |
119 | return PCIBIOS_DEVICE_NOT_FOUND; | 120 | return PCIBIOS_DEVICE_NOT_FOUND; |
120 | if (offset >= (unsigned long)phb->cfg_data) | 121 | if (offset >= (unsigned long)phb->cfg_data) |