[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1428492040-5581-12-git-send-email-sudipm.mukherjee@gmail.com>
Date: Wed, 8 Apr 2015 16:50:37 +0530
From: Sudip Mukherjee <sudipm.mukherjee@...il.com>
To: Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jean Delvare <jdelvare@...e.de>,
Wolfram Sang <wsa@...-dreams.de>,
Rodolfo Giometti <giometti@...eenne.com>,
"James E.J. Bottomley" <JBottomley@...allels.com>,
Mark Brown <broonie@...nel.org>,
Willy Tarreau <willy@...a-x.org>,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.de>
Cc: linux-kernel@...r.kernel.org, linux-i2c@...r.kernel.org,
netdev@...r.kernel.org, linux-scsi@...r.kernel.org,
linux-spi@...r.kernel.org, devel@...verdev.osuosl.org,
alsa-devel@...a-project.org,
Sudip Mukherjee <sudipm.mukherjee@...il.com>
Subject: [PATCH 11/14] net: plip: return proper error values from attach
now that we are monitoring the return value from attach, make the
required changes to return proper value from its attach function.
also return the proper error code in module_init.
Signed-off-by: Sudip Mukherjee <sudip@...torindia.org>
---
drivers/net/plip/plip.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/net/plip/plip.c b/drivers/net/plip/plip.c
index 040b897..6706bc3 100644
--- a/drivers/net/plip/plip.c
+++ b/drivers/net/plip/plip.c
@@ -1243,7 +1243,7 @@ plip_searchfor(int list[], int a)
/* plip_attach() is called (by the parport code) when a port is
* available to use. */
-static void plip_attach (struct parport *port)
+static int plip_attach(struct parport *port)
{
static int unit;
struct net_device *dev;
@@ -1254,13 +1254,13 @@ static void plip_attach (struct parport *port)
plip_searchfor(parport, port->number)) {
if (unit == PLIP_MAX) {
printk(KERN_ERR "plip: too many devices\n");
- return;
+ return -EINVAL;
}
sprintf(name, "plip%d", unit);
dev = alloc_etherdev(sizeof(struct net_local));
if (!dev)
- return;
+ return -ENOMEM;
strcpy(dev->name, name);
@@ -1300,12 +1300,13 @@ static void plip_attach (struct parport *port)
dev->name, dev->base_addr);
dev_plip[unit++] = dev;
}
- return;
+ return 0;
err_parport_unregister:
parport_unregister_device(nl->pardev);
err_free_dev:
free_netdev(dev);
+ return -ENODEV;
}
/* plip_detach() is called (by the parport code) when a port is
@@ -1379,6 +1380,8 @@ __setup("plip=", plip_setup);
static int __init plip_init (void)
{
+ int err;
+
if (parport[0] == -2)
return 0;
@@ -1387,9 +1390,10 @@ static int __init plip_init (void)
timid = 0;
}
- if (parport_register_driver (&plip_driver)) {
+ err = parport_register_driver(&plip_driver);
+ if (err) {
printk (KERN_WARNING "plip: couldn't register driver\n");
- return 1;
+ return err;
}
return 0;
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists