From: James Smart Date: Wed, 12 Jul 2017 22:50:12 +0000 (-0400) Subject: lpfc: Fix return value of board_mode store X-Git-Tag: v4.1.12-106.0.20170720_1900~50 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f990a4873e294e482a207ac36cc99b194958be9c;p=users%2Fjedix%2Flinux-maple.git lpfc: Fix return value of board_mode store [backport of b18f2a8765fc072701452f710ac164d243ee4579] From: rkennedy Orabug: 26439257 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: Brian Maly --- diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 651d39cdda0d..482f29a53b67 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -1093,6 +1093,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)