Skip to contentSkip to conversation

ppc, vio fix modalias_show return values

PATCH New Prarit Bhargava 1 participant 1 message Sep 23, 2013 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc, vio fix modalias_show return values

modalias_show() should return an empty string on error, not -ENODEV.

This causes the following false and annoying error:

Quoted 1 line

find /sys/devices -name modalias -print0 | xargs -0 cat >/dev/null

cat: /sys/devices/vio/4000/modalias: No such device
cat: /sys/devices/vio/4001/modalias: No such device
cat: /sys/devices/vio/4002/modalias: No such device
cat: /sys/devices/vio/4004/modalias: No such device
cat: /sys/devices/vio/modalias: No such device

---
 arch/powerpc/kernel/vio.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
arch/powerpc/kernel/vio.c +8 -4
index 78a3506..d38cc08 100644
@@ -1530,11 +1530,15 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 	const char *cp;
 
 	dn = dev->of_node;
-	if (!dn)
-		return -ENODEV;
+	if (!dn) {
+		strcat(buf, "\n");
+		return strlen(buf);
+	}
 	cp = of_get_property(dn, "compatible", NULL);
-	if (!cp)
-		return -ENODEV;
+	if (!cp) {
+		strcat(buf, "\n");
+		return strlen(buf);
+	}
 
 	return sprintf(buf, "vio:T%sS%s\n", vio_dev->type, cp);
 }
Signature · 1 line
1.7.9.3