[alsa-devel] [PATCH 06/14] spi: butterfly: return proper error values from attach

Sudip Mukherjee sudipm.mukherjee at gmail.com
Wed Apr 8 13:20:32 CEST 2015


now that we are monitoring the return value from attach, make the
required changes to return proper value from its attach function.

Signed-off-by: Sudip Mukherjee <sudip at vectorindia.org>
---
 drivers/spi/spi-butterfly.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-butterfly.c b/drivers/spi/spi-butterfly.c
index 9a95862..7df16c8 100644
--- a/drivers/spi/spi-butterfly.c
+++ b/drivers/spi/spi-butterfly.c
@@ -190,7 +190,7 @@ static struct flash_platform_data flash = {
 /* REVISIT remove this ugly global and its "only one" limitation */
 static struct butterfly *butterfly;
 
-static void butterfly_attach(struct parport *p)
+static int butterfly_attach(struct parport *p)
 {
 	struct pardevice	*pd;
 	int			status;
@@ -199,7 +199,7 @@ static void butterfly_attach(struct parport *p)
 	struct device		*dev = p->physport->dev;
 
 	if (butterfly || !dev)
-		return;
+		return -ENODEV;
 
 	/* REVISIT:  this just _assumes_ a butterfly is there ... no probe,
 	 * and no way to be selective about what it binds to.
@@ -287,7 +287,7 @@ static void butterfly_attach(struct parport *p)
 
 	pr_info("%s: AVR Butterfly\n", p->name);
 	butterfly = pp;
-	return;
+	return 0;
 
 clean2:
 	/* turn off VCC */
@@ -300,6 +300,7 @@ clean0:
 	(void) spi_master_put(pp->bitbang.master);
 done:
 	pr_debug("%s: butterfly probe, fail %d\n", p->name, status);
+	return status;
 }
 
 static void butterfly_detach(struct parport *p)
-- 
1.8.1.2



More information about the Alsa-devel mailing list