From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Smart Subject: [PATCH 09/15] lpfc: Fix return value of board_mode store routine in case of online failure Date: Tue, 30 May 2017 23:04:33 -0700 Message-ID: <20170531060439.2073-10-jsmart2021@gmail.com> References: <20170531060439.2073-1-jsmart2021@gmail.com> Return-path: Received: from mail-qk0-f194.google.com ([209.85.220.194]:33506 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751058AbdEaGFE (ORCPT ); Wed, 31 May 2017 02:05:04 -0400 Received: by mail-qk0-f194.google.com with SMTP id c206so738654qkb.0 for ; Tue, 30 May 2017 23:05:04 -0700 (PDT) In-Reply-To: <20170531060439.2073-1-jsmart2021@gmail.com> Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: linux-scsi@vger.kernel.org Cc: James Smart , Dick Kennedy , James Smart 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 --- 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 eb33473cbc62..8eee39de15f7 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -1351,6 +1351,8 @@ lpfc_board_mode_store(struct device *dev, struct device_attribute *attr, goto board_mode_out; } wait_for_completion(&online_compl); + if (status) + status = -EIO; } else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0) -- 2.11.0