From patchwork Sun Apr 23 05:32:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pan Bian X-Patchwork-Id: 9694521 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 649B7602A7 for ; Sun, 23 Apr 2017 05:33:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57AAB26CFF for ; Sun, 23 Apr 2017 05:33:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BE4927B2F; Sun, 23 Apr 2017 05:33:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E7CF26CFF for ; Sun, 23 Apr 2017 05:33:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1427482AbdDWFdC (ORCPT ); Sun, 23 Apr 2017 01:33:02 -0400 Received: from m50-133.163.com ([123.125.50.133]:40599 "EHLO m50-133.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932067AbdDWFdA (ORCPT ); Sun, 23 Apr 2017 01:33:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=XfaD9aXSr+fHcUOh70 DQQPnbJJ/r0wkbl8mCz+y6qX0=; b=f9GATCh7XMmpp2aZTUePNgr/CkgX4s/Vvy K2xS2NxZ8eXzLJOJAxm12I0tPMVsUGcsmlX4/t9mwN2NSRe6o0nAHEz0hU3m0MgJ ufdP+XycKwc+1xFFE+KONNtZzHCHFSUjJBl+NTsOpnmehNp8Qz4rcHL4aXUadzpz ZrWl9gl5Y= Received: from localhost.localdomain (unknown [123.118.194.153]) by smtp3 (Coremail) with SMTP id DdGowAA3qF14PPxY4hsQAA--.203S3; Sun, 23 Apr 2017 13:32:42 +0800 (CST) From: Pan Bian To: Bradley Grove , "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH 1/1] scsi: esas2r: fix unchecked return value Date: Sun, 23 Apr 2017 13:32:39 +0800 Message-Id: <1492925559-1383-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: DdGowAA3qF14PPxY4hsQAA--.203S3 X-Coremail-Antispam: 1Uf129KBjvdXoWruF15uFy7tFW7XryDJry8uFg_yoW3ZFX_Wr W7Zr1Ivr4xGF18t3WftrWavrZI9r48ZFsY9w1Fqasay3yxur1DXr4UXr1DXws7W3yxZryD Ca90vryFkr12yjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU1qjg3UUUUU== X-Originating-IP: [123.118.194.153] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/1tbiNhrCclWBV57+YwAAsc Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Function pci_enable_device() returns a negative errno on failure, and its return value should be validated. In function esas2r_resume(), its return value is ignored. This patch fixes the bug. Signed-off-by: Pan Bian --- drivers/scsi/esas2r/esas2r_init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/esas2r/esas2r_init.c b/drivers/scsi/esas2r/esas2r_init.c index 6432a50..f482664 100644 --- a/drivers/scsi/esas2r/esas2r_init.c +++ b/drivers/scsi/esas2r/esas2r_init.c @@ -728,6 +728,8 @@ int esas2r_resume(struct pci_dev *pdev) esas2r_log_dev(ESAS2R_LOG_INFO, &(pdev->dev), "pci_enable_device() called"); rez = pci_enable_device(pdev); + if (rez) + goto error_exit; pci_set_master(pdev); if (!a) {