Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp124611imm; Thu, 14 Jun 2018 16:42:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJbK3sFY9UwyhcLoI9YUm6fqAeWOjsssTKfSpwFiRQP4pER8FpkwyEtg0d8lv3Itm8Mo9/j X-Received: by 2002:a63:b543:: with SMTP id u3-v6mr4066738pgo.365.1529019750504; Thu, 14 Jun 2018 16:42:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529019750; cv=none; d=google.com; s=arc-20160816; b=S3cX3tYERjrillfkfks1OcAjhX7wutvjO6P+OlDks48AT1ihvdaWo6WbGoevuElxTS b2ShbQ2vzWZQHrZXmi6HbpARm2H+PYnAvEKZumuSraAnoElJ231XAzuCK+oDeECkXBz0 xXUp0mcsP4h+NAjQStFa1DEsHOP0dfY/XU5jyXDmcK47Ync96Drg0zKYTJmJm8y9G/qe pWWoJ/44yAX3BxNdzUAoSFqiND8x2VSKMeozHD/eukPaDE8NPrMR4jMN4+lmsPqnDBO1 +ePnxwiDydVkeic9kFaa3HwtdzO2lcAgaj37LnCInfa9mu10yfA8SixI4S1M8UYK+4XG MoSg== 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=dkb3VUc4xoAcDFTCNdQiGUQCXp+PgrPRBCs5iUfoRg8=; b=crK4Cv9RchxmU1slhxQX9nJCgvGz8wITj/ljxqy3sDH2lmgW6GCiPn7GPqjApEb/1o Cq3UROYRKw76vCh7qyIG95DWC3odw3vgrondMC9OZ8Az/Pe7BjEiExqANybfMzloklIe 6wrNUqudWHWFHJ0qQENsZ57KGMvty22kPoR5kG0M3PnKBNVlYyld1A4qP96X1hBYNYxu 7i+audOPI0kNqoQLm21a2CfhLrMRhAoTb3JTB9noBt+sIp4m1zuWz+ltG+QcuXY6I5Ut 5S9ItAXV7erqBru7XlqfSGRZjPhcBF0CZMlzfeG2EBz2jTT+GH+ndg5dnIZzGSSipZ/g s5dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=CSfQZDgX; 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 v11-v6si6448449plp.25.2018.06.14.16.42.16; Thu, 14 Jun 2018 16:42:30 -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=CSfQZDgX; 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 S965163AbeFNXlx (ORCPT + 99 others); Thu, 14 Jun 2018 19:41:53 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35546 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965001AbeFNXlv (ORCPT ); Thu, 14 Jun 2018 19:41:51 -0400 Received: by mail-pg0-f65.google.com with SMTP id 15-v6so3614504pge.2; Thu, 14 Jun 2018 16:41:51 -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=dkb3VUc4xoAcDFTCNdQiGUQCXp+PgrPRBCs5iUfoRg8=; b=CSfQZDgX4Caw13oUANUdH6ibXgbq7EzVu2c5xBXg2hz0oOz677yRXODiykcMBjWRfR 4gpbTNjRS7ZdJr7jLadlcw4DcBrGBs4tQd4/en4w70t820hmQ/Zgfv30+brr7/KGSXOp 2vm/YRiA1IZHUFdcS8XNoAj5c/ZpmphfwEo3bERJi8LF3DFNelb3Z9Mjy3/LzcIVxDLj Ifai8y5I4t8nxYPuAJfertOfCIVrF7PWw42IwGyuSOswjARksOwL/uz8iiTmbqsbXfOy EWxOY+PUJMhzgkPQEbCSBowlLhE8lFGBune1ckDZYfxCfeLq9y/pJKWjlmHw1dzGj3sk q1Yw== 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=dkb3VUc4xoAcDFTCNdQiGUQCXp+PgrPRBCs5iUfoRg8=; b=FFrPAc4Ygajh0TFOK+gDH+d3sJhxpDUc6P3D/fvj7Zgj+EKgigiKu1+mvSq0eu6MXY cy441tKuLnz5ogISr48NyRvxWR1B15D3KilUrGikjcQPd2ddLYfe0aO63y3bN4iR852N raEhNBaLa9UO4KCLCC95ZHwd6or3vGcKBUqYyZxOzh1M+yxcEDdpQqREHA5/6E7PPiX+ lg/GSmvZ8dRCRbEYaezjNexE5lHCRdL8bgdWjInO9gP4EAD8+TeU1xKBbKbzFHYz7P3o WNdzSrr1n8AAHDmTKGjElaUiEEHXBl0JvIck6cHPyXH7C9kQui0A9tlZD+LgxAwfUOJg HkRA== X-Gm-Message-State: APt69E3XOcU0BPRzmZYn6Q+sDEw5qS2oMPfxZsuJG6OaABwQXtMD1tCE 72vAPqVy1RrycIHrMWBxki0= X-Received: by 2002:a63:7a07:: with SMTP id v7-v6mr4001182pgc.444.1529019711408; Thu, 14 Jun 2018 16:41:51 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id q200-v6sm8409139pgq.9.2018.06.14.16.41.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jun 2018 16:41:50 -0700 (PDT) From: Zhouyang Jia Cc: Zhouyang Jia , "James E.J. Bottomley" , "Martin K. Petersen" , Hannes Reinecke , Johannes Thumshirn , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] pcmcia: add error handling for pcmcia_enable_device Date: Fri, 15 Jun 2018 07:41:38 +0800 Message-Id: <1529019701-55981-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. v2->v3: - Change the return value. --- 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..9d5751a 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 ret; - pcmcia_enable_device(link); if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) { -- 2.7.4