Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4796646iog; Wed, 22 Jun 2022 06:09:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uVJ3nEXfCdvMoGVQX6h76UhV9BlTGfqnmKHN0zh0z4JHFF1YpuBUJE+XomAIp+zqm1s4TW X-Received: by 2002:a17:906:3f94:b0:722:fb52:5a24 with SMTP id b20-20020a1709063f9400b00722fb525a24mr520208ejj.604.1655903374883; Wed, 22 Jun 2022 06:09:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655903374; cv=none; d=google.com; s=arc-20160816; b=ZgdgCYun2XZx21xzV9WCFckci5GggX+SPYAZMlyTy7M4eFci8cOb33RLcx+q9Qly3X Cmd3Avfbg1HUvz1K0Uufkgza7lQl4Tsqg5ni93bgo7GflKG00MHmnB9V1oyvJ6+9K+x7 axYCU5FH6meNMaXSDSdAyAud7QBcIy15k0DVEctuovn3gR2Xdc8CSQn1o0dgu/cwOqVd MDKZ3ltUYYcWdmwJhZ8+sX4W+Oki6n/eMFExekInlEO2pJ/Zstome5rJqCFDqQJMH0xZ WU9g83A+O+na2lGA4y5tixQBVZPSxNEmc6GolxsG65jeVCF6YUFlqTsl13q37jPWGZk4 KSaQ== 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=z2rA0W5MQEkSqYtlT4qSoC6M5wvdwN+5pEfR1Vnrrfw=; b=KmpUsECP573J+qdO6F8tagCXtkGFV2pDat314WKWsACMY7ca1a53XWXU7TPylu4zZR 3UspqaQ61ZuTF3htP/HwvOWm/OaQbEWYoytoQtzi+pDhD/vzhZPpoO96d2E08+g9/HWD BUPHVSxcJRXDDMzIV+P/J5eZYEvFhran7dbTUCWkSxGC1TzguHckruyU8OWO/ZglRfXS w+ubRz8vO1l+IAamP+iu6sBjJlYHGRK0yCrCBf9WT3QdAl2st2TRJ1ej3EIg8PfIGlhz rUfinlTcm4gM5fUaUSk7LhDxRx6hghY4woPBUuvdAeDKBoYjI7SMeJFbw+HUBAGBZQzG ZVlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=fEscaRrS; 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 g3-20020a1709065d0300b007182c0c1b91si1788099ejt.865.2022.06.22.06.09.06; Wed, 22 Jun 2022 06:09:34 -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=fEscaRrS; 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 S239763AbiFVMgI (ORCPT + 99 others); Wed, 22 Jun 2022 08:36:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232239AbiFVMfx (ORCPT ); Wed, 22 Jun 2022 08:35:53 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91A6035AB7; Wed, 22 Jun 2022 05:35:52 -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 9B98622249; Wed, 22 Jun 2022 14:35:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1655901350; 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=z2rA0W5MQEkSqYtlT4qSoC6M5wvdwN+5pEfR1Vnrrfw=; b=fEscaRrS0S8pfj/seZ8BNUWdQ8uycvqEZsvctzKo1x7DaSt8P/uSJYX77paBf38R3XxGI0 BmNhYwfm+cbap3apAf48oMkb09mdHWhU0zFYZFQnUdJJY1qSfXphkJzNTHxQESZr3Oxke+ GIx938sHesGUKLhrYvji7qUOfmJtSM4= From: Michael Walle To: Andrew Lunn , Heiner Kallweit , Russell King , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck , Michael Walle Subject: [PATCH net-next 2/2] net: phy: nxp-tja11xx: use devm_hwmon_sanitize_name() Date: Wed, 22 Jun 2022 14:35:43 +0200 Message-Id: <20220622123543.3463209-3-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220622123543.3463209-1-michael@walle.cc> References: <20220622123543.3463209-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/net/phy/nxp-tja11xx.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c index 9944cc501806..2a8195c50d14 100644 --- a/drivers/net/phy/nxp-tja11xx.c +++ b/drivers/net/phy/nxp-tja11xx.c @@ -444,15 +444,10 @@ static int tja11xx_hwmon_register(struct phy_device *phydev, struct tja11xx_priv *priv) { struct device *dev = &phydev->mdio.dev; - int i; - - priv->hwmon_name = devm_kstrdup(dev, dev_name(dev), GFP_KERNEL); - if (!priv->hwmon_name) - return -ENOMEM; - for (i = 0; priv->hwmon_name[i]; i++) - if (hwmon_is_bad_char(priv->hwmon_name[i])) - priv->hwmon_name[i] = '_'; + priv->hwmon_name = devm_hwmon_sanitize_name(dev, dev_name(dev)); + if (IS_ERR(priv->hwmon_name)) + return PTR_ERR(priv->hwmon_name); priv->hwmon_dev = devm_hwmon_device_register_with_info(dev, priv->hwmon_name, -- 2.30.2