Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1070479pxb; Tue, 29 Mar 2022 16:29:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+KdcfYRaJBJNIkPnJecdtgvd8yM6ujLD9l6qauvZE/VXCHTJFJbvwM7f9vMyg4iwGrrwO X-Received: by 2002:a63:d44c:0:b0:380:8c48:e040 with SMTP id i12-20020a63d44c000000b003808c48e040mr3861968pgj.14.1648596542117; Tue, 29 Mar 2022 16:29:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648596542; cv=none; d=google.com; s=arc-20160816; b=n9aQ4yfycyI8v525apU/ayAGD4TWCx4jMX2t6Ffjsvoy0OYAga7XCW9ijaoRqAojiR MGZXWp6Y89HpVMsoBXgDSvIWUX/gaqlEa8Fn+ECxdYI0T2pQQ29EyeSoKjMrdYgMMezf nQXULIAgxkFMmCF4cDRDMoAd2HXkEK/0fUIAMXsJQ4N4Hn92RAcvieGXxFfwR1CXrOJk mq85XMYlI8ueywBmzF5EoOe//KoyXwjzHqHoRMGNVaqrrnL7gHj8UG9J4q878r0l3XVg repCVwKcjFzQ1Cu7BQsKbN9kcLjF43EOnuhIH5D4K47GEk4foTvj5OqtXM6CKQoYI5Ne +d/g== 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 :dkim-signature; bh=e5UG7gDs4FZr3J53shS1BpkjUTdnpD0iO94yDhlgvUA=; b=PQAfV/DS0BQd7whB6pz/Lmv9RayoeW8Eozs8h14Ddg6wb89Vgz1utJ7NXwrODDAsol vgzkD5RoOUhci3IHKqaPWCkxgg0D5/oRzmSLv4eQBGgFKvK4nGPYgBDFSPAXlAXWrnH1 vW+o7jVMTC+WbcffkemDlAkuwBYIgvDvgbct1pCLXARABv3rWhxaClThFl5l8Wcm8ws9 fsLPi6iX/vvbkf96mU7Uxo8z+Q0ayfsWyapDSDdh1FJ8wKIPWyEJuSDLxu71SFnLkGhi rNYqxDRHrw6Xc7uY39w/so879LxR7VZPlpxZTSWEP92Uzbk/CfxJu/6H8S1jHOahskvX exDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=m9ss5Ium; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bg26-20020a056a02011a00b003980ae22575si16476199pgb.438.2022.03.29.16.28.48; Tue, 29 Mar 2022 16:29:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=m9ss5Ium; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239247AbiC2QJx (ORCPT + 99 others); Tue, 29 Mar 2022 12:09:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239330AbiC2QJc (ORCPT ); Tue, 29 Mar 2022 12:09:32 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BCE025EC9F; Tue, 29 Mar 2022 09:07:47 -0700 (PDT) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 8122722249; Tue, 29 Mar 2022 18:07:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1648570065; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e5UG7gDs4FZr3J53shS1BpkjUTdnpD0iO94yDhlgvUA=; b=m9ss5IumVUrEEKWoVvbHpkoGmEcDkC4SFZfBRxtH9q9UBBDSUPHQZJbdhvlbnXmU4+mU91 5ASgPWa8b2G4rsGO9yrMEDYdFDqaSWJnPTgwmHcFPQ49Ym1UfH6mMOUFoxGVqHbVZf8b6q z0/jhG8Eot6dWpbkzMxBS/ftt+rEM9o= From: Michael Walle To: Xu Yilun , Tom Rix , Jean Delvare , Guenter Roeck , Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Michael Walle Subject: [PATCH v2 2/5] hwmon: intel-m10-bmc-hwmon: use devm_hwmon_sanitize_name() Date: Tue, 29 Mar 2022 18:07:27 +0200 Message-Id: <20220329160730.3265481-3-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220329160730.3265481-1-michael@walle.cc> References: <20220329160730.3265481-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of open-coding the bad characters replacement in the hwmon name, use the new devm_hwmon_sanitize_name(). Signed-off-by: Michael Walle --- drivers/hwmon/intel-m10-bmc-hwmon.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/hwmon/intel-m10-bmc-hwmon.c b/drivers/hwmon/intel-m10-bmc-hwmon.c index 7a08e4c44a4b..29370108fa1c 100644 --- a/drivers/hwmon/intel-m10-bmc-hwmon.c +++ b/drivers/hwmon/intel-m10-bmc-hwmon.c @@ -515,7 +515,6 @@ static int m10bmc_hwmon_probe(struct platform_device *pdev) struct intel_m10bmc *m10bmc = dev_get_drvdata(pdev->dev.parent); struct device *hwmon_dev, *dev = &pdev->dev; struct m10bmc_hwmon *hw; - int i; hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL); if (!hw) @@ -528,14 +527,10 @@ static int m10bmc_hwmon_probe(struct platform_device *pdev) hw->chip.info = hw->bdata->hinfo; hw->chip.ops = &m10bmc_hwmon_ops; - hw->hw_name = devm_kstrdup(dev, id->name, GFP_KERNEL); + hw->hw_name = devm_hwmon_sanitize_name(dev, id->name); if (!hw->hw_name) return -ENOMEM; - for (i = 0; hw->hw_name[i]; i++) - if (hwmon_is_bad_char(hw->hw_name[i])) - hw->hw_name[i] = '_'; - hwmon_dev = devm_hwmon_device_register_with_info(dev, hw->hw_name, hw, &hw->chip, NULL); return PTR_ERR_OR_ZERO(hwmon_dev); -- 2.30.2