From patchwork Wed Apr 8 11:20:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 6178961 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 06BB79F1C4 for ; Wed, 8 Apr 2015 11:30:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F9702013A for ; Wed, 8 Apr 2015 11:30:14 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id E9FF520123 for ; Wed, 8 Apr 2015 11:30:12 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1F5D826535F; Wed, 8 Apr 2015 13:30:12 +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 51A002654BC; Wed, 8 Apr 2015 13:24:27 +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 24D2F2654B2; Wed, 8 Apr 2015 13:24:25 +0200 (CEST) Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by alsa0.perex.cz (Postfix) with ESMTP id 234A62652E4 for ; Wed, 8 Apr 2015 13:22:28 +0200 (CEST) Received: by pabtp1 with SMTP id tp1so6227109pab.2 for ; Wed, 08 Apr 2015 04:22:27 -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=E81u1k+L4lx5LuvSZgtT1ugQ2TP1Y3zyoyDjCArPcvQ=; b=RQvsOsQn/kAtFRAMgGryCa+akPyht1QF/QcAbiCXvaWU98kA1poHBN10QEVmaI6UGZ 4qRucfKS3jEeUq3NNVsWk4cGxUajBdndlsPRAhf7L1L5z4Ac8JG5IcQfCMrWdAvLzDd7 8ccg5z9XGSYwS9UfkQWtTL2ySjmGhVtinIpW5Hdr2ts7cNiuxXHmZUsklvGN7OCCEgqz ILP0ZIHXUC0iQXCX45XNboKo5NNkECEfAL12ESgZ6fdrHcUjBtiAOy4//yYLwofeKhJP cN5Ipey2mY5xsewOvsQ+hgATKyze1cvm4m6krlF9ewFZ1hP8NuxwD/kJmZtkup9HX4tT 5GUw== X-Received: by 10.70.14.226 with SMTP id s2mr45711009pdc.145.1428492147508; Wed, 08 Apr 2015 04:22:27 -0700 (PDT) Received: from localhost.localdomain ([122.169.147.27]) by mx.google.com with ESMTPSA id og11sm10973411pdb.91.2015.04.08.04.22.21 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Apr 2015 04:22:26 -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:40 +0530 Message-Id: <1428492040-5581-15-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 14/14] char: lp: 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. Signed-off-by: Sudip Mukherjee --- 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)