Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2055771pxb; Sat, 14 Nov 2020 11:29:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJx4zbE2TgjERAq+KYykfmdaAcCJknwckfTyvmvpnxWTU6VZ8fTVIkpjNzH6sHOKJb0DkWAn X-Received: by 2002:a05:6402:716:: with SMTP id w22mr8786681edx.214.1605382157014; Sat, 14 Nov 2020 11:29:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605382157; cv=none; d=google.com; s=arc-20160816; b=t1n8u/5NzTuq2JE6xFNj1a+K03m9+BXAV8CqNgciH0BopX/YwTyWZNsJ0EOCQGwAlF Uq52wtPhyJS3l5xF5rbcVz4gfZ+IHWkGHx6LkRH4Yyv8V2ZMoGBn/CtydWdDWbQ10u00 l084esOqHP1yFM+ASZFhsxEcu3F3a1HWNPnhA4ZN4vJTmo4ZcsNCugwiXXes5rKTjpCG BzFgWkhAtIHvlwKzLaPe9V3n0sJ9tb1vBNcqJCPIQmtIPLDcC0unCVx4uECuJ60+7an1 qb4PGgzAhiDqAZ+OnKGrMxj67RPBDBv4t3Ls1f05Q/1e3xbjwJ/jWYml6xFu5v95RGsN UD/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:subject:cc:to:from:date :dkim-signature; bh=zPlGIZhhZPVqB96dYPH/XkW/fiMl49jiDnL90YlRack=; b=gZEglphDNrZZywvJOI33YKMCUJHSnGgCSXms37JI0/i9Eaj3r5gJXFsEWRtcpB9XJE ifHoYVG4EoOgO8oO8m+aRdkkN/IHBgXX4GaQF7EfDSS7TJEhbVC0yyOkuFpWvUaOGDN4 7PqR7l/qhKB+cIeRXRTuiU6LBLAJj1dcG8XZ09ZecEYwhW0UcQldxHsRG6z8zYkS7mTj IGzsdsRYXN266Dk59EEYdf7h7p2mgSxdqbIPaTYMLI/xABgSouZ7rNg0aqVHodAb10+t iF6IEPOt9P1GP3jnzIyHJPQbtjb0w9N+BLdPnZabDb4bMOULSqnbOaOtdU/weFAfuwpP EI3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tQox0vn3; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v21si8426052ejy.444.2020.11.14.11.28.54; Sat, 14 Nov 2020 11:29:16 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=tQox0vn3; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726217AbgKNT01 (ORCPT + 99 others); Sat, 14 Nov 2020 14:26:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:53872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbgKNT01 (ORCPT ); Sat, 14 Nov 2020 14:26:27 -0500 Received: from kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com (c-67-180-217-166.hsd1.ca.comcast.net [67.180.217.166]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7FEF1207DE; Sat, 14 Nov 2020 19:26:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605381986; bh=vBzq4R/SyYKFpJiusG2EXsFFlVZc7qzjeYaPsRcJO2I=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=tQox0vn39qQHtdYqfOT25ZbA7j5kfLUZIV3+HM/fXF1PurfG55rYMOOFujkSqrwLY poCdxHr6xLKXqYb1kgMmluT67rQDWltG9EDBvk+bI0BaiKpIyCy0Pdmlyc0Q90wABd mB0m75OkXHtgTMsf86qmdAYkhc96+YYE5Uyk27uA= Date: Sat, 14 Nov 2020 11:26:25 -0800 From: Jakub Kicinski To: Zhang Changzhong Cc: , , , , , , , Subject: Re: [PATCH net] net: phy: smsc: add missed clk_disable_unprepare in smsc_phy_probe() Message-ID: <20201114112625.440b52f2@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <1605180239-1792-1-git-send-email-zhangchangzhong@huawei.com> References: <1605180239-1792-1-git-send-email-zhangchangzhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 12 Nov 2020 19:23:59 +0800 Zhang Changzhong wrote: > Add the missing clk_disable_unprepare() before return from > smsc_phy_probe() in the error handling case. > > Fixes: bedd8d78aba3 ("net: phy: smsc: LAN8710/20: add phy refclk in support") > Reported-by: Hulk Robot > Signed-off-by: Zhang Changzhong > --- > drivers/net/phy/smsc.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c > index ec97669..0fc39ac 100644 > --- a/drivers/net/phy/smsc.c > +++ b/drivers/net/phy/smsc.c > @@ -291,8 +291,10 @@ static int smsc_phy_probe(struct phy_device *phydev) > return ret; > > ret = clk_set_rate(priv->refclk, 50 * 1000 * 1000); > - if (ret) > + if (ret) { > + clk_disable_unprepare(priv->refclk); > return ret; > + } > > return 0; > } Applied, thanks! The code right above looks highly questionable as well: priv->refclk = clk_get_optional(dev, NULL); if (IS_ERR(priv->refclk)) dev_err_probe(dev, PTR_ERR(priv->refclk), "Failed to request clock\n"); ret = clk_prepare_enable(priv->refclk); if (ret) return ret; I don't think clk_prepare_enable() will be too happy to see an error pointer. This should probably be: priv->refclk = clk_get_optional(dev, NULL); if (IS_ERR(priv->refclk)) return dev_err_probe(dev, PTR_ERR(priv->refclk), "Failed to request clock\n");