[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPgLHd_w9B8sHg9i9msFLx8FVBypqTtDEVOt1-VBNTW4zwHTMQ@mail.gmail.com>
Date: Fri, 7 Sep 2012 14:45:55 +0800
From: Wei Yongjun <weiyj.lk@...il.com>
To: benh@...nel.crashing.org, paulus@...ba.org,
grant.likely@...retlab.ca, rob.herring@...xeda.com
Cc: yongjun_wei@...ndmicro.com.cn, linuxppc-dev@...ts.ozlabs.org,
devicetree-discuss@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: [PATCH] powerpc/powernv: move the dereference below the NULL test
From: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>
The dereference should be moved below the NULL test.
spatch with a semantic match is used to found this.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>
---
arch/powerpc/platforms/powernv/pci.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index be3cfc5..4ba89c1 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -287,13 +287,15 @@ static int pnv_pci_read_config(struct pci_bus *bus,
int where, int size, u32 *val)
{
struct pci_controller *hose = pci_bus_to_host(bus);
- struct pnv_phb *phb = hose->private_data;
+ struct pnv_phb *phb;
u32 bdfn = (((uint64_t)bus->number) << 8) | devfn;
s64 rc;
if (hose == NULL)
return PCIBIOS_DEVICE_NOT_FOUND;
+ phb = hose->private_data;
+
switch (size) {
case 1: {
u8 v8;
@@ -331,12 +333,14 @@ static int pnv_pci_write_config(struct pci_bus *bus,
int where, int size, u32 val)
{
struct pci_controller *hose = pci_bus_to_host(bus);
- struct pnv_phb *phb = hose->private_data;
+ struct pnv_phb *phb;
u32 bdfn = (((uint64_t)bus->number) << 8) | devfn;
if (hose == NULL)
return PCIBIOS_DEVICE_NOT_FOUND;
+ phb = hose->private_data;
+
cfg_dbg("pnv_pci_write_config bus: %x devfn: %x +%x/%x -> %08x\n",
bus->number, devfn, where, size, val);
switch (size) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists