Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1703825imm; Thu, 14 Jun 2018 02:24:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLDdbOXFjOU1ZAiQn69chOgWlrb0I5S8ytrHy8JXpC3tsNx0ZmYeKWFZ90H/1tancqyt527 X-Received: by 2002:a17:902:7105:: with SMTP id a5-v6mr2113193pll.171.1528968277852; Thu, 14 Jun 2018 02:24:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528968277; cv=none; d=google.com; s=arc-20160816; b=OP2QuqMTBEr171J44V6VAPPUPKT/gedKK2MT9nm4xbdk3XsdANZ56z03w96ZJ/UFsJ GAk79Cbz+LTCnevEht7HmKYIRqetpM8GCIphoM4L306uJ2iljwnVPDMK1r2/zLGerkkq xfqm2z8eXX6D9p14LwIPWflMC4a6xgGcSMixQ3OEV5jpaiLbr5sFt0R5cJlzaWMH7qYi Dhi8fF0KXMW/1kHvsm/cVFNRHzrJ4X1SqM4PQduj98itDHPJce4fKTEbq1TegREPFCAs 2L4fUggkV/iVIEKIXxt/Gg1BDYFbzQWGFdtk8BTu6ojSLuWMcbL0bQQPi85o2goPUvIf yhmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:in-reply-to:message-id:date :subject:cc:from:dkim-signature:arc-authentication-results; bh=G5CWUE+DJQk737A80kvtUR0W5C/zN0zB8ULk15CCzUE=; b=L1F9eGhJtmGgvUAZzoOkMBfdAKg1fA+SHNY3/6l7lvj3WxpxCOFLqafM1u5w7YHnvA 85oxkxOeBEgU01DChHBUS6KlTjlxDT6d8OlhgNiq2hHM0fRLnXBOu6zplf0DUUrel4/a vHcchlOHZc0wueBreLIaSDztHWA25HIKOqCPNbkabh6UN/H7HOXa7qq7zmFjKcQa2cSC 2oIMVp5xzdr2qbXzQLPzyg5aETdYTkYcwCvcQQQDFfeUQGGbWREzlG/4wCsoPEZT2E29 xg7HtnxeC2JRCB1Rpw+ldVFXoC9Pl/54Nr91leGJM+vby55LrjsAjLeYA04V0syCe+8X VY3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=nSVb7Ord; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3-v6si1512316pgf.339.2018.06.14.02.24.10; Thu, 14 Jun 2018 02:24:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=nSVb7Ord; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754745AbeFNJXh (ORCPT + 99 others); Thu, 14 Jun 2018 05:23:37 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:40547 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754571AbeFNJXf (ORCPT ); Thu, 14 Jun 2018 05:23:35 -0400 Received: by mail-pg0-f66.google.com with SMTP id l2-v6so2641882pgc.7; Thu, 14 Jun 2018 02:23:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=G5CWUE+DJQk737A80kvtUR0W5C/zN0zB8ULk15CCzUE=; b=nSVb7OrdyQkf19aj4F9badYh7pBANXjeWPSd1c/jLg0QFB7IGbfCt/r1DHOx4cEm3D dEmK1vWAV3BzfMfvFCLa41yTMMS/e/dDxxKs0pKa3WKXg211BqL5JjNjj0RajMqH84Dz pyA8QGNLrsggcaoJqWXVHvDib0HgrzO1i+LhS0buhobzMVzZMyYwN5u1t7MKgPojBpEU AipXt3kTWCiy48mCjDBpKYDwadyai4rYlDTsgk+zSCbberuOm49M0nyAXiV77UX927rW R5gLYe1piauVTRjeTE9YpgPsGXRf3U6Rwf4QYNP/Y/fyLyO6uuThVwgFOhZgCv3l5e36 aLTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=G5CWUE+DJQk737A80kvtUR0W5C/zN0zB8ULk15CCzUE=; b=aCZ1FN054Uv8mTdSggSMfqcPcfbdFs/0x0q2hZ3Xxc0sjI9cb3NB3QWkkphV2OvWJS DvJl4pq6HdUbr+NM1n6+NW6McL0eRA/7N0wyjcXCqj/VfHXVtJZMIVA6oVkm9SLkm10J YRzKhRmp/oZB7i17Qsq6BlsbQKOj2/5DnqjR8PsnSKAH+usQqJAQQfAu7qRwIzE7nJoE wHGyDcfa6kvG02TNm55UX8oY81DGgqr/jeHCRQmBWgAbXYxt884YSGTlAPGsxHfbSCgD hVRzpmeWM/qlE2HBUMONap1m6FPYfAJW4xJDUsChCxALnrhnJ7+lv/679DbycuF0o/uO mE8g== X-Gm-Message-State: APt69E2m4Yj+Wpsix+YuWgiMJH7BEsZmi17HfYCtx74UuDfVyjvitsxp BqkChTQzYcouuL0Fv4a1w0s= X-Received: by 2002:a63:7983:: with SMTP id u125-v6mr1593428pgc.267.1528968214939; Thu, 14 Jun 2018 02:23:34 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id k13-v6sm2774275pfg.130.2018.06.14.02.23.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jun 2018 02:23:34 -0700 (PDT) From: Zhouyang Jia Cc: Zhouyang Jia , "James E.J. Bottomley" , "Martin K. Petersen" , Johannes Thumshirn , Hannes Reinecke , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] pcmcia: add error handling for pcmcia_enable_device Date: Thu, 14 Jun 2018 17:23:25 +0800 Message-Id: <1528968207-48671-1-git-send-email-jiazhouyang09@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528694152-31724-1-git-send-email-jiazhouyang09@gmail.com> References: <1528694152-31724-1-git-send-email-jiazhouyang09@gmail.com> To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When pcmcia_enable_device fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling pcmcia_enable_device. Signed-off-by: Zhouyang Jia --- v1->v2: - Remove pcmcia_disable_device. --- drivers/scsi/pcmcia/qlogic_stub.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index 0556054..eb2c8bf 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c @@ -254,8 +254,12 @@ static void qlogic_release(struct pcmcia_device *link) static int qlogic_resume(struct pcmcia_device *link) { scsi_info_t *info = link->priv; + int ret; + + ret = pcmcia_enable_device(link); + if (ret) + return -ENODEV; - pcmcia_enable_device(link); if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) { -- 2.7.4