Skip to contentSkip to conversation

Fix a null pointer check in ssb mipscore init

PATCH In review Felix Fietkau 2 participants 2 messages Oct 14, 2007 Sonics silicon backplane driver (ssb)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix a null pointer check in ssb mipscore init

Fix a null pointer check in ssb mipscore init

drivers/ssb/driver_mipscore.c +2 -1
@@ -171,20 +171,21 @@ u32 ssb_cpu_clock(struct ssb_mipscore *mcore)
 	return rate;
 }
 
 void ssb_mipscore_init(struct ssb_mipscore *mcore)
 {
-	struct ssb_bus *bus = mcore->dev->bus;
+	struct ssb_bus *bus;
 	struct ssb_device *dev;
 	unsigned long hz, ns;
 	unsigned int irq, i;
 
 	if (!mcore->dev)
 		return; /* We don't have a MIPS core */
 
 	ssb_dprintk(KERN_INFO PFX "Initializing MIPS core...\n");
 
+	bus = mcore->dev->bus;
 	hz = ssb_clockspeed(bus);
 	if (!hz)
 		hz = 100000000;
 	ns = 1000000000 / hz;
 
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · On Sunday 14 October 2007 21:04:22 Felix Fietkau wrote:

Fix a null pointer check in ssb mipscore init

Quoted 28 lines
drivers/ssb/driver_mipscore.c +2 -1
@@ -171,20 +171,21 @@ u32 ssb_cpu_clock(struct ssb_mipscore *mcore)
 	return rate;
 }
 
 void ssb_mipscore_init(struct ssb_mipscore *mcore)
 {
-	struct ssb_bus *bus = mcore->dev->bus;
+	struct ssb_bus *bus;
 	struct ssb_device *dev;
 	unsigned long hz, ns;
 	unsigned int irq, i;
 
 	if (!mcore->dev)
 		return; /* We don't have a MIPS core */
 
 	ssb_dprintk(KERN_INFO PFX "Initializing MIPS core...\n");
 
+	bus = mcore->dev->bus;
 	hz = ssb_clockspeed(bus);
 	if (!hz)
 		hz = 100000000;
 	ns = 1000000000 / hz;
 
Signature · 1 line
Greetings Michael.