From patchwork Wed Apr 8 11:20:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 6178891 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6762F9F1C4 for ; Wed, 8 Apr 2015 11:28:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8EE4B20357 for ; Wed, 8 Apr 2015 11:28:29 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 6175E2012D for ; Wed, 8 Apr 2015 11:28:28 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 94C2D2657A5; Wed, 8 Apr 2015 13:28:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_SORBS_WEB, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id B712C26546F; Wed, 8 Apr 2015 13:23:44 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 02E7B26546F; Wed, 8 Apr 2015 13:23:43 +0200 (CEST) Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by alsa0.perex.cz (Postfix) with ESMTP id 56704265329 for ; Wed, 8 Apr 2015 13:22:09 +0200 (CEST) Received: by pddn5 with SMTP id n5so112298688pdd.2 for ; Wed, 08 Apr 2015 04:22:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HBYtVmN62Fp/qbhAUOAD1WZTFgj793TncF/UeZeJrYY=; b=fn34p2Jc/T2FN+GocLqsat386PyVg7K5m1HMY2P7dFAB9eqQCCVd3JbIvufzOMLYQk BBkfYljm8hqi8ZZkqysfb5S5MA5RJmflJjhzkP/M+2Lp9SmP5Ahpl1xZibvKL9V984cY EnvkqAfm7XA03wjUz/6/RnBtVy/Qr3S3pa8Yn545XaodbU+nlv5Ju7l8e92OKJu06o7I Ss8hrNNKD311luxDKVUz4TArW0XH5bwYBQAt8MnsmSfFtoWgp7cgjNtKB5siH0HyFJWp QbhrICjM9hd0KErtks2rhhHyqrD9jRBdH5liruSq8cguM0S6YzN9/HzgR5CDhsfLQi+n rUYg== X-Received: by 10.66.139.135 with SMTP id qy7mr44877062pab.144.1428492128632; Wed, 08 Apr 2015 04:22:08 -0700 (PDT) Received: from localhost.localdomain ([122.169.147.27]) by mx.google.com with ESMTPSA id og11sm10973411pdb.91.2015.04.08.04.22.02 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Apr 2015 04:22:07 -0700 (PDT) From: Sudip Mukherjee To: Arnd Bergmann , Greg Kroah-Hartman , Jean Delvare , Wolfram Sang , Rodolfo Giometti , "James E.J. Bottomley" , Mark Brown , Willy Tarreau , Jaroslav Kysela , Takashi Iwai Date: Wed, 8 Apr 2015 16:50:37 +0530 Message-Id: <1428492040-5581-12-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1428492040-5581-1-git-send-email-sudipm.mukherjee@gmail.com> References: <1428492040-5581-1-git-send-email-sudipm.mukherjee@gmail.com> Cc: devel@driverdev.osuosl.org, alsa-devel@alsa-project.org, linux-scsi@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-i2c@vger.kernel.org, Sudip Mukherjee Subject: [alsa-devel] [PATCH 11/14] net: plip: return proper error values from attach X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;