Thread (3 messages) flat view 3 messages, 3 authors, 2006-07-10
STALE7342d

[PATCH] Make snd-aoa cope with lack of line-output-detect property

From: Paul Mackerras <hidden>
Date: 2006-07-10 12:39:47
Subsystem: aoa (apple onboard audio) alsa driver, sound, the rest · Maintainers: Johannes Berg, Jaroslav Kysela, Takashi Iwai, Linus Torvalds

The snd-aoa stuff falls over on my G4 powerbook (1.5GHz Albook) with a
null pointer dereference in of_find_property.  It turns out that this
was because it couldn't find a device node for the line-output detect
GPIO.  This patch fixes it.

Signed-off-by: Paul Mackerras <redacted>
---
diff --git a/sound/aoa/core/snd-aoa-gpio-feature.c b/sound/aoa/core/snd-aoa-gpio-feature.c
index 7ae0c0b..e35a1c6 100644
--- a/sound/aoa/core/snd-aoa-gpio-feature.c
+++ b/sound/aoa/core/snd-aoa-gpio-feature.c
@@ -112,7 +112,10 @@ static struct device_node *get_gpio(char
 
 static void get_irq(struct device_node * np, int *irqptr)
 {
-	*irqptr = irq_of_parse_and_map(np, 0);
+	if (np)
+		*irqptr = irq_of_parse_and_map(np, 0);
+	else
+		*irqptr = -1;	/* XXX should this be NO_IRQ? */
 }
 
 /* 0x4 is outenable, 0x1 is out, thus 4 or 5 */
@@ -322,7 +325,7 @@ static int ftr_set_notify(struct gpio_ru
 		return -EINVAL;
 	}
 
-	if (irq == -1)
+	if (irq == -1)		/* XXX should this be NO_IRQ? */
 		return -ENODEV;
 
 	mutex_lock(&notif->mutex);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help