[PATCH 05/14] spi: lm70llp: return proper error values from attach

From: Sudip Mukherjee
Date: Wed Apr 08 2015 - 07:21:44 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-lm70llp.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-lm70llp.c b/drivers/spi/spi-lm70llp.c
index ba72347..9b0fde1 100644
--- a/drivers/spi/spi-lm70llp.c
+++ b/drivers/spi/spi-lm70llp.c
@@ -190,7 +190,7 @@ static u32 lm70_txrx(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits)
return bitbang_txrx_be_cpha0(spi, nsecs, 0, 0, word, bits);
}

-static void spi_lm70llp_attach(struct parport *p)
+static int spi_lm70llp_attach(struct parport *p)
{
struct pardevice *pd;
struct spi_lm70llp *pp;
@@ -201,7 +201,7 @@ static void spi_lm70llp_attach(struct parport *p)
printk(KERN_WARNING
"%s: spi_lm70llp instance already loaded. Aborting.\n",
DRVNAME);
- return;
+ return -EALREADY;
}

/* TODO: this just _assumes_ a lm70 is there ... no probe;
@@ -281,7 +281,7 @@ static void spi_lm70llp_attach(struct parport *p)
pp->spidev_lm70->bits_per_word = 8;

lm70llp = pp;
- return;
+ return 0;

out_bitbang_stop:
spi_bitbang_stop(&pp->bitbang);
@@ -296,6 +296,7 @@ out_free_master:
(void) spi_master_put(master);
out_fail:
pr_info("%s: spi_lm70llp probe fail, status %d\n", DRVNAME, status);
+ return status;
}

static void spi_lm70llp_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/