From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sn1nam02on0094.outbound.protection.outlook.com ([104.47.36.94]:35040 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755774AbeDIAfI (ORCPT ); Sun, 8 Apr 2018 20:35:08 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: James Smart , Dick Kennedy , James Smart , "Martin K . Petersen" , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 025/162] scsi: lpfc: Fix return value of board_mode store routine in case of online failure Date: Mon, 9 Apr 2018 00:28:00 +0000 Message-ID: <20180409002738.163941-25-alexander.levin@microsoft.com> References: <20180409002738.163941-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002738.163941-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: James Smart [ Upstream commit 522dceeb62ded1a7b538d2f1f61cc69a1402537d ] On hbacmd reset failure, observing wrong string "nline" in kernel log. On failure, non negative value (1) is returned from sysfs store routine. It is interpreted as count by kernel and store routine is called again with the remaining characters as input. Fix: Return negative error code (-EIO) in case of failure. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/lpfc/lpfc_attr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 4639dac64e7f..5708bbc056c6 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -1090,6 +1090,8 @@ lpfc_board_mode_store(struct device *dev, struct devi= ce_attribute *attr, goto board_mode_out; } wait_for_completion(&online_compl); + if (status) + status =3D -EIO; } else if (strncmp(buf, "offline", sizeof("offline") - 1) =3D=3D 0) status =3D lpfc_do_offline(phba, LPFC_EVT_OFFLINE); else if (strncmp(buf, "warm", sizeof("warm") - 1) =3D=3D 0) --=20 2.15.1