From patchwork Thu Aug 10 17:52:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: weiping zhang X-Patchwork-Id: 9894449 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 1D80160384 for ; Thu, 10 Aug 2017 17:52:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FEC22862D for ; Thu, 10 Aug 2017 17:52:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04D6028B4F; Thu, 10 Aug 2017 17:52:29 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 DB17D2862D for ; Thu, 10 Aug 2017 17:52:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752829AbdHJRw1 (ORCPT ); Thu, 10 Aug 2017 13:52:27 -0400 Received: from mx1.didichuxing.com ([111.202.154.82]:13622 "EHLO BJEXMBX012.didichuxing.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752437AbdHJRw1 (ORCPT ); Thu, 10 Aug 2017 13:52:27 -0400 Received: from localhost.didichuxing.com (172.22.50.20) by BJSGEXMBX04.didichuxing.com (172.20.15.134) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Fri, 11 Aug 2017 01:52:23 +0800 Date: Fri, 11 Aug 2017 01:52:17 +0800 From: weiping zhang To: , CC: Subject: [PATCH] scsi-sysfs: correct errno for host_reset Message-ID: <20170810175212.GA19528@localhost.didichuxing.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [172.22.50.20] X-ClientProxiedBy: BJEXCAS004.didichuxing.com (172.20.1.44) To BJSGEXMBX04.didichuxing.com (172.20.15.134) 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 if scsi_host_template->host_reset is NULL, when user "echo adapter > /sys/class/scsi_host/hostx/host_reset", -EINVAL will return even string compare successfully. It make user confuse. change to: -EINVAL if string not match "adapter" / "firmware"; -EOPNOTSUPP if string match but not implement ->host_reset. Signed-off-by: weiping zhang --- drivers/scsi/scsi_sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index dff8faf..3e664f4 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -272,6 +272,8 @@ store_host_reset(struct device *dev, struct device_attribute *attr, if (sht->host_reset) ret = sht->host_reset(shost, type); + else + ret = -EOPNOTSUPP; exit_store_host_reset: if (ret == 0)