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: 6178591 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 07C79BF4A6 for ; Wed, 8 Apr 2015 11:23:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F6B42034F for ; Wed, 8 Apr 2015 11:23:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 399C120373 for ; Wed, 8 Apr 2015 11:23:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751629AbbDHLWq (ORCPT ); Wed, 8 Apr 2015 07:22:46 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:36328 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754094AbbDHLW3 (ORCPT ); Wed, 8 Apr 2015 07:22:29 -0400 Received: by pdea3 with SMTP id a3so112344284pde.3; 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 Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, netdev@vger.kernel.org, linux-scsi@vger.kernel.org, linux-spi@vger.kernel.org, devel@driverdev.osuosl.org, alsa-devel@alsa-project.org, Sudip Mukherjee Subject: [PATCH 14/14] char: lp: return proper error values from attach 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> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB, T_DKIM_INVALID, T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.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)