From patchwork Sat Dec 3 10:34:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pan Bian X-Patchwork-Id: 9459593 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 C1C0E60459 for ; Sat, 3 Dec 2016 10:35:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B07A128469 for ; Sat, 3 Dec 2016 10:35:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A50E42847C; Sat, 3 Dec 2016 10:35:20 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 4360828469 for ; Sat, 3 Dec 2016 10:35:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751981AbcLCKe6 (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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=1yDfQEclEp6zjUeNYv LOpDkKU463GfsoZviaZU0Yj+c=; b=AdtnuJn/j0Y7URkfDLE8T1AdRv6Cb0JmHe CqC1N2w6Z5qrNrAahI/ei9CYxDAm833B+r6bUdn1jK621vW6yXl4WjGkYqYYqA3d mis0OqIZ9loXwScfCYojLvp3Wlx1pwy6ItYGE69kV2cYCUXsuMiO0lfSzscFNC74 RIHwAoEks= Received: from localhost.localdomain (unknown [222.131.246.88]) by smtp4 (Coremail) with SMTP id DtGowAD3_hKpn0JYrxwkIg--.56192S3; Sat, 03 Dec 2016 18:34:21 +0800 (CST) 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-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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