Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752466AbcLCKe6 (ORCPT ); Sat, 3 Dec 2016 05:34:58 -0500 Received: from m50-134.163.com ([123.125.50.134]:38529 "EHLO m50-134.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751605AbcLCKe5 (ORCPT ); Sat, 3 Dec 2016 05:34:57 -0500 From: Pan Bian To: "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH 1/1] scsi: csiostor: fix improper return value Date: Sat, 3 Dec 2016 18:34:17 +0800 Message-Id: <1480761257-4667-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: DtGowAD3_hKpn0JYrxwkIg--.56192S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7Gw18Ar4DJr43GryxWrykKrg_yoWfXrc_ur W0qrsFgr4kAa1vkryfG34fXF9I9a4UuFW0kF1SqF13Ar1DZwn5C3WkXFyrurZ8Jr4xWF9x Ga1kXFy7ur15CjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU5OeOPUUUUU== X-Originating-IP: [222.131.246.88] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/xtbBzw81claDsccX7QAAse Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 843 Lines: 28 Function csio_hw_flash_erase_sectors() will always return 0, even on failures. Thus, its callers will not detect the errors, and may produce unexpected behavior. To avoid bugs, this patch replaces "return 0;" with "return ret;". Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188681 Signed-off-by: Pan Bian --- drivers/scsi/csiostor/csio_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c index 622bdab..8970df2 100644 --- a/drivers/scsi/csiostor/csio_hw.c +++ b/drivers/scsi/csiostor/csio_hw.c @@ -613,7 +613,7 @@ struct t4_vpd_hdr { csio_err(hw, "erase of flash sector %d failed, error %d\n", start, ret); csio_wr_reg32(hw, 0, SF_OP_A); /* unlock SF */ - return 0; + return ret; } static void -- 1.9.1