Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3644439imm; Sun, 10 Jun 2018 22:18:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJXTV7DDmHBEEjs2zT2tNViFUq4rZurCl/DQJIGUShgkt4OOlSfcxFwiuEN2w+MvkZLlX8r X-Received: by 2002:a17:902:683:: with SMTP id 3-v6mr17029132plh.291.1528694325333; Sun, 10 Jun 2018 22:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528694325; cv=none; d=google.com; s=arc-20160816; b=CYE8lok1/VPMEE9rpP+v3BRLSo/eCC6CuYvt9Ynprej5p8dqamGxhN/Zc2mB1JLnNz 6xChHN25IjpKdBGqoS9KT8ramieFSWlihvRRXkCBePoAihYNnx6H6RIPoN2re+CWLg6x vYIWp4Kh7xoU8VRegoEQgiPb1ONT2xy2qc4KlX6uNcNcL8LUN438F8N0Qx2GVcJ4tQhe YjbA4LySb+Zb+bG6E4Uou7RKiGus2Iuz595a53Tjvh9MLuzPLMQD9vIWzk1SitvBW7BU RsesYg+QlFts13TDfTJ2DXl5I/tvUs2qCpIQQKyP7HJJvUg2l5uBLzEVrZaY4moQPNit NTTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature:arc-authentication-results; bh=9HnoT00GA/e4hqOrOsR5vOygtqQIU8ZliGrohbyJ7B8=; b=as6Xk/L5t5x/ueyxOC2kFIIZLrzVHvuprncZwIUTNL4ML8xEaWdBGVapQaZvnoXvbd S+zw2qxqqzZEKn9gmU773u4cOZjbwrucrRcfEHL4srSERjxMBtTQMXIPQUY4rvDgv4Jy kf7B3joUc3+HHktxMdnqdN3LqrIcKA7WChyVcroGgWbJtj03XetooMy3REgD4ZOU+h+7 mUmwd9H5lcQpqGKk3Ebv0gc9TVBQVixIRqHnhqxPC0vc4iSyYcg7RvELiD82A2VZ3WTM 0HED/cTY9pRGNenaK+9FGH/RZr0TNeXdXq3w111gZx9qLJ87BJEafUNlDAv+iINk8FAw HeCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=YpQq/U/p; 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 n22-v6si6534885pff.370.2018.06.10.22.18.31; Sun, 10 Jun 2018 22:18:45 -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=YpQq/U/p; 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 S1754023AbeFKFQf (ORCPT + 99 others); Mon, 11 Jun 2018 01:16:35 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:46609 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753911AbeFKFQb (ORCPT ); Mon, 11 Jun 2018 01:16:31 -0400 Received: by mail-pf0-f193.google.com with SMTP id q1-v6so9581395pff.13; Sun, 10 Jun 2018 22:16:31 -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; bh=9HnoT00GA/e4hqOrOsR5vOygtqQIU8ZliGrohbyJ7B8=; b=YpQq/U/pDVPE8Ir+DaDWKrS3GbzC8URtjRh1KR5kYS0eRxbIrqzXvC9ilQvL0n8rOr foS+VJo3IKHoV+7hMeRnafS4UIdCzJijASkRAfO6YNph69B0uPXkl74CVBmXWgOrR250 aTfyNjUgdw0ik7CtV6VXhL8St2zMU3de6kKiuoQDkEPcVgu6wqEf7V2Zu3HYlewODbpM uThnIIRNJbXcBkfcTDpnHe2oVA1CKs0peuDxKJMuqSJ7NpMqk8nUDuFi2fVVqDFirxqo hANszDzUiOY+Bn1694328f8sXdydcFb0wNl55wI3dxxBjzty4DG7JptfyXLskwEfuzHs 3OAw== 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; bh=9HnoT00GA/e4hqOrOsR5vOygtqQIU8ZliGrohbyJ7B8=; b=dtKaOBLzfNPddI93mF6xbo2ZcnLhjMnn5wv6/fVroGitUQ83+AL/VjVGrWV2LtWhkU un5ZtKBlxtnteMo++eYKJEJJilaLqf9qa/5ek4KXEKY2wht1pN1sBnXpx8qD7OdGUFEu AHYkuROXyiz7mXiyo355yhHIoTKReSDMkj2zjXgTp+a2xnDGYUPcV1iaSCvfhdp8IGqK wLs250xNKVK5GRYAnGFhEX8fsuovhHHqZYVO+hq/xjVUkDePVZi0JyNvo/1qjmAhXn2u Xt0KQxOyOkQhJezHkZFC78ZLqXcXdUv81fjxKz0EKNf2QYSNEJBDYrzeEXvhsHenzJAb RHvw== X-Gm-Message-State: APt69E0Ssf0Zrm19L8MLq4phnkCgkgElYkpyTlkOiMsNpvbnH/FbUyBt 3rIKc8CLpP2RQuy0ppmkQYY= X-Received: by 2002:a62:40dc:: with SMTP id f89-v6mr15791018pfd.194.1528694190968; Sun, 10 Jun 2018 22:16:30 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id m9-v6sm108051463pff.41.2018.06.10.22.16.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Jun 2018 22:16:30 -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] pcmcia: add error handling for pcmcia_enable_device Date: Mon, 11 Jun 2018 13:15:50 +0800 Message-Id: <1528694152-31724-1-git-send-email-jiazhouyang09@gmail.com> X-Mailer: git-send-email 2.7.4 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 --- drivers/scsi/pcmcia/qlogic_stub.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index 0556054..9287d52 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c @@ -254,8 +254,14 @@ 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) { + pcmcia_disable_device(link); + return -ENODEV; + } - pcmcia_enable_device(link); if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) { -- 2.7.4