Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3508250pxb; Mon, 4 Apr 2022 19:14:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqw0uzSW+DHX2h6xXMCJhvwFpr5uyAg129aVw53QYR/qrIuTR4Fc1wWIynUFwoWiIGTPiM X-Received: by 2002:a63:794c:0:b0:398:2f41:4b0f with SMTP id u73-20020a63794c000000b003982f414b0fmr934750pgc.448.1649124868348; Mon, 04 Apr 2022 19:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649124868; cv=none; d=google.com; s=arc-20160816; b=SS3TJumNtrrdfP3VzK13+Z/4AoZTJV+vs9sjdeqEzn4+bCPfHlIBHv0Ni/Kjm1cM/q uMlaat5HPo7DrO5Qt/odv/fyNiLVmpSgAFp38iYUBbXONS+ioHYRV+NmG7ruyknJ/vLs l40gixXWqWIjuXThk/yEe7FOUWBenEicwqMNgDnjwIWStWnLnU7M7PNRV21xzz/fTp4g lg+YG+HaSKYrE3ZOklCoanqYfhDdaNksq7efA4I+4WAh1/t7rPNKyZ9UMQyEHmHgdw9C O53tUJlVuRGRi+oo/alAJzRQbMwTejBRVnTATJgcXVSon+8lvldewMru9OlMplqQOoyK tnHA== 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=8T4Bmbwsv7HCxQnqjaUsg1Pjf07n8QjfD124DBCrwKE=; b=nmlnO8/uSH7Nc6l/4vfNLzrCusybG6IB5qjAkfwPZfcAxYoXp2fRN2rdNa4WXhZlAy Zlps4t5XP4aOgKngUs4X5itBTbmyjMcQ0fVnc6GwF1Zw8Wooz+T9ZSKgWyqVinjq9VwC sSYKi6P505GhMAtiRhcC4JPsq+cqOMCMQ7PanoT/5Ip/zQpj0ikcaDPBEptBUQE5Ist/ Jusg2ufoqy9O1k4lqrnduomAmk9gCRc64+rmUmVoiX04TU+p1pNfZ+77IVnbTUxM1+CH hd+aI1clh1Wf/pNOScjMVDs8WXH6Solli6IJF8hcR4U2wr6Z66z5WA/McqVYlNVt3qhK Elfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=IurJXUG2; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id b21-20020a056a000a9500b004fa3a8dff59si12649161pfl.16.2022.04.04.19.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 19:14:28 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=IurJXUG2; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A852227680D; Mon, 4 Apr 2022 17:37:31 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347246AbiDDV3N (ORCPT + 99 others); Mon, 4 Apr 2022 17:29:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380041AbiDDSpq (ORCPT ); Mon, 4 Apr 2022 14:45:46 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C50C8B854; Mon, 4 Apr 2022 11:43:49 -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 BD12822247; Mon, 4 Apr 2022 20:43:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1649097827; 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=8T4Bmbwsv7HCxQnqjaUsg1Pjf07n8QjfD124DBCrwKE=; b=IurJXUG25bhPilYCCBfmeUPhauzDFfAmbDGTvGpbzV87Pfvm9OMFw56sP1L/G50l0nFZAG Rpgaewev/u9rnaleVFZCUFYqIQyB/jcgmXcVc0M71yBnJfxZO8q3ZMY734vwg/DZNkHr5O oLlj2w9j2sEZSQO/rz9/Wq4geqtZJms= 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, David Laight , Michael Walle Subject: [PATCH v3 2/2] hwmon: intel-m10-bmc-hwmon: use devm_hwmon_sanitize_name() Date: Mon, 4 Apr 2022 20:43:40 +0200 Message-Id: <20220404184340.3973329-3-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220404184340.3973329-1-michael@walle.cc> References: <20220404184340.3973329-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Acked-by: Xu Yilun --- 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