lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1428492040-5581-15-git-send-email-sudipm.mukherjee@gmail.com>
Date:	Wed,  8 Apr 2015 16:50:40 +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 14/14] char: lp: 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.

Signed-off-by: Sudip Mukherjee <sudip@...torindia.org>
---
 drivers/char/lp.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index c4094c4..6988480 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -900,34 +900,40 @@ static int lp_register(int nr, struct parport *port)
 	return 0;
 }
 
-static void lp_attach (struct parport *port)
+static int lp_attach(struct parport *port)
 {
 	unsigned int i;
+	int ret = -ENODEV;
 
 	switch (parport_nr[0]) {
 	case LP_PARPORT_UNSPEC:
 	case LP_PARPORT_AUTO:
 		if (parport_nr[0] == LP_PARPORT_AUTO &&
 		    port->probe_info[0].class != PARPORT_CLASS_PRINTER)
-			return;
+			return ret;
 		if (lp_count == LP_NO) {
 			printk(KERN_INFO "lp: ignoring parallel port (max. %d)\n",LP_NO);
-			return;
+			return ret;
 		}
-		if (!lp_register(lp_count, port))
+		if (!lp_register(lp_count, port)) {
 			lp_count++;
+			ret = 0;
+		}
 		break;
 
 	default:
 		for (i = 0; i < LP_NO; i++) {
 			if (port->number == parport_nr[i]) {
-				if (!lp_register(i, port))
+				if (!lp_register(i, port)) {
 					lp_count++;
+					ret = 0;
+				}
 				break;
 			}
 		}
 		break;
 	}
+	return ret;
 }
 
 static void lp_detach (struct parport *port)
-- 
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ