Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp488668ybh; Mon, 20 Jul 2020 23:44:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqoXBxQTMJMBNZRmJTY9SSMvxabg33SpEzzb7M1Vl+KVAr0B1tVX5ZRH4M4KNvEkikhLqX X-Received: by 2002:a17:907:1189:: with SMTP id uz9mr24687237ejb.478.1595313863146; Mon, 20 Jul 2020 23:44:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595313863; cv=none; d=google.com; s=arc-20160816; b=p43ia2Q/qmuYPu2Q9vX/twN1S4gW0ohkQJ/kCNcwowz8Ic2LoBhKTPkpUN6MqzlAY7 2zcjXkO7BJiRDUDXiEBjhN8+jwNl+Yz4Mibpfpp7/mBpgsWQ5xxvE42rmCbGaGjGV5JB /9PNSNxQromJqNbf7jSOOPfxu5HUoe8Od2D8erOciAum5vDbpINLaDujKCUWVT0XXhCi NkCsmyc1Bl3UKD6TpNDFwZwxm5hr5R1TEo/2HyEn/yNDqmP3AIQwJr5aQACJzli31die fOLfeWPWhrzJZJ8ki0YpGHx0tvJjHob9UFfqKeF4mWdFJU+cRJWKDk0pfMsB/qEnhfLA sHmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=9UleHAtlUT+xg/jYp6gjWsy1ATx7Y/MSWpB70tYWKjU=; b=tes7OH4kDlLCvjaQdBBC5J4ztQ3ixpOgtkzA/T7C8OW77yZihDsD5bydRbOCNFWCnB zkEY/AXlailZgPsJGg0ZTEADimAFni63hiJdIQbzldcA+0pWQn1YKpgvvEe3m5YWGKg7 FfzpujWWT3sT/qPpo5DYKOpebRlsrdO9fSO8qjnBkvTK7+ba3Ka/OoZGukO5aqX4jOIf UAThnwUWCsrPg0uXVqNtaHzh151V5ATZLKi1YTHoC21tEhFbkPIvZc5OPEiEsJF2p9YK GLGfRasBS7b25ark5VGYTAA/4+ITMepiTQIIz+B2+8IZ81aMhKlFvnZApEfpdBR7APFy b8qg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o10si11762053ejx.722.2020.07.20.23.44.00; Mon, 20 Jul 2020 23:44:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728188AbgGUGl7 (ORCPT + 99 others); Tue, 21 Jul 2020 02:41:59 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8340 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726127AbgGUGl7 (ORCPT ); Tue, 21 Jul 2020 02:41:59 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 2A8488869F8712D5EE36; Tue, 21 Jul 2020 14:41:55 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.487.0; Tue, 21 Jul 2020 14:41:46 +0800 From: Xiongfeng Wang To: , , CC: , , , , Subject: [PATCH v2] ipmi/watchdog: add missing newlines when printing parameters by sysfs Date: Tue, 21 Jul 2020 14:35:09 +0800 Message-ID: <1595313309-43881-1-git-send-email-wangxiongfeng2@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When I cat some ipmi_watchdog parameters by sysfs, it displays as follows. It's better to add a newline for easy reading. root@(none):/# cat /sys/module/ipmi_watchdog/parameters/action resetroot@(none):/# cat /sys/module/ipmi_watchdog/parameters/preaction pre_noneroot@(none):/# cat /sys/module/ipmi_watchdog/parameters/preop preop_noneroot@(none):/# Signed-off-by: Xiongfeng Wang --- drivers/char/ipmi/ipmi_watchdog.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 55986e1..f78156d 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c @@ -232,12 +232,17 @@ static int set_param_str(const char *val, const struct kernel_param *kp) static int get_param_str(char *buffer, const struct kernel_param *kp) { action_fn fn = (action_fn) kp->arg; - int rv; + int rv, len; rv = fn(NULL, buffer); if (rv) return rv; - return strlen(buffer); + + len = strlen(buffer); + buffer[len++] = '\n'; + buffer[len] = 0; + + return len; } -- 1.7.12.4