Skip to contentSkip to conversation

powerpc/mpc5121: fix NULL test

PATCH New Roel Kluin 1 participant 1 message Jan 4, 2009

Subsystems (2)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 powerpc/mpc5121: fix NULL test

strcmp on NULL results in a segmentation fault, also, remove the second, redundant test on dev

---
Please verify whether this patch correct.

arch/powerpc/platforms/512x/clock.c +2 -2
index f416014..1bcff94 100644
@@ -56,12 +56,12 @@ static struct clk *mpc5121_clk_get(struct device *dev, const char *id)
 	int dev_match = 0;
 	int id_match = 0;
 
-	if (dev == NULL && id == NULL)
+	if (dev == NULL || id == NULL)
 		return NULL;
 
 	mutex_lock(&clocks_mutex);
 	list_for_each_entry(p, &clocks, node) {
-		if (dev && dev == p->dev)
+		if (dev == p->dev)
 			dev_match++;
 		if (strcmp(id, p->name) == 0)
 			id_match++;