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

From: Sudip Mukherjee
Date: Wed Apr 08 2015 - 07:21:48 EST


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@xxxxxxxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/