Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1450146pxf; Fri, 2 Apr 2021 10:45:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXT79RurSqAmtlaTFdd3n/BrPWAS00e3F8Ljhzsab5roLXBLNUaTQCsWLZQtLU0wqJUOUk X-Received: by 2002:a17:906:704a:: with SMTP id r10mr15153247ejj.312.1617385546811; Fri, 02 Apr 2021 10:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617385546; cv=none; d=google.com; s=arc-20160816; b=j1ytEUrdxEpJf7/+zaS09PwzEGC6w2XxUiKLVevrCeMKfyEdBguWkP5ZJ5A4JPfBX1 6CNamFofkln9cF2YLlzLOODWOMQrTYaMI1jV+FoDqBRwy+XGvFhJscU8XP3D7hPPMGhS 53vcix96hGOJArPsXM+Q3Yj+YHeCkMQDA89C0AG6XYnMX7AmtDkGxy9nJD9Pw2ZmUP6S EEm6zBKOUX628Wy/pH1VWnp3he1guGEjFModiVSFBGgSgawrTDlP8fZGOGXrbm3GhA60 O31kqVuAYGoRH7IAwbZcVKnaEb7Ej/aiaShfvRCkYOCoGG9GQn30xgbtmhLsvcUCNPAG eelA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=cPfDlB/ym+mgT5Trs1wqHU2mquKLbkZMwNfI9wLY+To=; b=pCTawjQSCeAA97WVyawz2RE7RzgnDhvWK8owdMAVyeSvSSeeT2tyb5jvKbN8SE/NAC g/zMAW+/Io6KIp3uIm+wjKlc2Ar9ncviEXnJ+wBB+02xTbVIQpv4Ji6QG1RONF+DXovd Cc3H2WTm+QORvmBf8jNAwgkM/kVQp8ZF56iT3G7xSjVb0L3B38YT9xhpcD7H3Chmmsxf P/u3D1Yh1mq7ss0n3Y9ufF4WMXCK6qrsqXBq73K26tKV5RfgmoFKQKzZRQun0FCsL4YU bSr2wY4XmnZYZGG+ZBLywVoOwjYkcH7I/FtdUoa7zGnB7FJ4wTpuEGmM/+FzmHxuT0ym Ncxg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f1si6749678ejc.617.2021.04.02.10.45.24; Fri, 02 Apr 2021 10:45:46 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235942AbhDBRnv (ORCPT + 99 others); Fri, 2 Apr 2021 13:43:51 -0400 Received: from mga17.intel.com ([192.55.52.151]:26096 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235166AbhDBRnc (ORCPT ); Fri, 2 Apr 2021 13:43:32 -0400 IronPort-SDR: 10/LdvaKx0qTFA6YS76S53/Qxi8XbaWKW7rNDHdqqymO+G7HcFRZ5uTCa1vpLtj3wQ5u9ckubb jtKKAFWBPQ0g== X-IronPort-AV: E=McAfee;i="6000,8403,9942"; a="172543164" X-IronPort-AV: E=Sophos;i="5.81,300,1610438400"; d="scan'208";a="172543164" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2021 10:43:28 -0700 IronPort-SDR: rrtGNnNEFXtyqRVPHSXwHdVcfr1+xESwVdsc0unV7lIAKnbVuFZWux3e+l7jv209uojoVyqzr8 6cuZBCzyQFag== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,300,1610438400"; d="scan'208";a="413277896" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 02 Apr 2021 10:43:26 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C6F3360D; Fri, 2 Apr 2021 20:43:39 +0300 (EEST) From: Andy Shevchenko To: Corey Minyard , Andy Shevchenko , openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: Corey Minyard Subject: [PATCH v2 08/10] ipmi_si: Use strstrip() to remove surrounding spaces Date: Fri, 2 Apr 2021 20:43:32 +0300 Message-Id: <20210402174334.13466-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210402174334.13466-1-andriy.shevchenko@linux.intel.com> References: <20210402174334.13466-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of home grown analogue, use strstrip() from the kernel library. Signed-off-by: Andy Shevchenko --- drivers/char/ipmi/ipmi_si_hotmod.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/char/ipmi/ipmi_si_hotmod.c b/drivers/char/ipmi/ipmi_si_hotmod.c index 4fbb4e18bae2..087f5eb1ebc0 100644 --- a/drivers/char/ipmi/ipmi_si_hotmod.c +++ b/drivers/char/ipmi/ipmi_si_hotmod.c @@ -185,24 +185,16 @@ static atomic_t hotmod_nr; static int hotmod_handler(const char *val, const struct kernel_param *kp) { - char *str = kstrdup(val, GFP_KERNEL), *curr, *next; int rv; struct ipmi_plat_data h; - unsigned int len; - int ival; + char *str, *curr, *next; + str = kstrdup(val, GFP_KERNEL); if (!str) return -ENOMEM; /* Kill any trailing spaces, as we can get a "\n" from echo. */ - len = strlen(str); - ival = len - 1; - while ((ival >= 0) && isspace(str[ival])) { - str[ival] = '\0'; - ival--; - } - - for (curr = str; curr; curr = next) { + for (curr = strstrip(str); curr; curr = next) { enum hotmod_op op; next = strchr(curr, ':'); @@ -235,7 +227,7 @@ static int hotmod_handler(const char *val, const struct kernel_param *kp) put_device(dev); } } - rv = len; + rv = strlen(val); out: kfree(str); return rv; -- 2.30.2