linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Check for altname == NULL in snd-pmac-gpio.c
@ 2006-01-22  4:43 Ben Collins
  0 siblings, 0 replies; only message in thread
From: Ben Collins @ 2006-01-22  4:43 UTC (permalink / raw)
  To: Linuxppc-dev

Since callers don't have to pass altname, snd-pmac-gpio.c should have
been checking for NULL, and it wasn't.

Also, fixes the pmf_unregister_irq_client() call to match the previous
patch.

Signed-off-by: Ben Collins <bcollins@ubuntu.com>

diff --git a/sound/ppc/snd-pmac-gpio.c b/sound/ppc/snd-pmac-gpio.c
index 25ef5e9..480e1ca 100644
--- a/sound/ppc/snd-pmac-gpio.c
+++ b/sound/ppc/snd-pmac-gpio.c
@@ -41,7 +41,7 @@ static struct pmf_function *get_audio_pf
 		return NULL;
 
 	pfunc = pmf_find_function(np, name);
-	if (pfunc == NULL && altname != NULL)
+	if (pfunc == NULL && altname)
 		pfunc = pmf_find_function(np, altname);
 
 	return pfunc;
@@ -58,10 +58,10 @@ static struct device_node *find_audio_gp
 	for (np = np->child; np; np = np->sibling) {
 		char *property = get_property(np, "audio-gpio", NULL);
 		if (property && (strcmp(property, name) == 0 ||
-		    strcmp(property, altname) == 0))
+		    (altname && strcmp(property, altname) == 0)))
 			break;
 		if (device_is_compatible(np, name) ||
-		    device_is_compatible(np, altname))
+		    (altname && device_is_compatible(np, altname)))
 			break;
         }
 
@@ -136,11 +136,7 @@ void snd_pmac_free_gpio(snd_pmac_gpio_t 
 {
 	if (gp->pfunc != NULL) {
 		if (gp->irq_client.owner == THIS_MODULE) {
-			/* XXX: pmf_unregister_irq_client doesn't use its
-			 * first two arguments. We only need to send it
-			 * the irq_client. WATCH FOR THIS CHANGING!
-			 */
-			pmf_unregister_irq_client(NULL, NULL, &gp->irq_client);
+			pmf_unregister_irq_client(&gp->irq_client);
 			gp->irq_client.owner = NULL;
 		}
 
@@ -233,7 +229,7 @@ int snd_pmac_request_irq(snd_pmac_gpio_t
 
 		if ((np = find_devices("i2s-a"))) {
 			ret = pmf_register_irq_client(np, gp->name, &gp->irq_client);
-			if (ret < 0)
+			if (ret < 0 && gp->altname)
 				ret = pmf_register_irq_client(np, gp->altname, &gp->irq_client);
 		}
 		if (ret < 0)


-- 
Ben Collins
Kernel Developer - Ubuntu Linux

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-01-22  4:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-22  4:43 [PATCH] Check for altname == NULL in snd-pmac-gpio.c Ben Collins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).