Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1427511AbdDWFdL (ORCPT ); Sun, 23 Apr 2017 01:33:11 -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 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 774 Lines: 25 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) { -- 1.9.1