From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C46FC64E7B for ; Tue, 1 Dec 2020 16:06:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5037206E3 for ; Tue, 1 Dec 2020 16:06:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="S26NKxDQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391975AbgLAQGN (ORCPT ); Tue, 1 Dec 2020 11:06:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388498AbgLAQGN (ORCPT ); Tue, 1 Dec 2020 11:06:13 -0500 Received: from mail-vs1-xe41.google.com (mail-vs1-xe41.google.com [IPv6:2607:f8b0:4864:20::e41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8B82C0613CF for ; Tue, 1 Dec 2020 08:05:32 -0800 (PST) Received: by mail-vs1-xe41.google.com with SMTP id k17so1165558vsp.13 for ; Tue, 01 Dec 2020 08:05:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OuJ+iD6xtM+VMtARqwefKzhnGpcfRpOS7XnUWAe2JEY=; b=S26NKxDQQMuZxt+1oFstIH0f+WpADwmUSiWsrMAdTuElMG8Tk8kY59fXqelvjthP2f 8db5WERWrK0YCQ4FqlHnBMH/ZATTA6HxEq1tiNLnrLiqZSw/17r/KXgIXCoHSH+Gy1Ww SMYLtA7y7XlkxaPsi0YpsQTcdqtJX+8n/g450= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OuJ+iD6xtM+VMtARqwefKzhnGpcfRpOS7XnUWAe2JEY=; b=T3V7yyfpX4c+zhP2Aqdn3GFwVrisPCEbYL5jumJAX0ekpknz3b2z0eMN177aDjaSTw 0ADsQHcFlqsOKGwmQa05oSukC5Vqns1u6QMkfPu9ekPIafnWBva/WvnWoRWJA+9U++Hw gdm1kYD303hyvP9yat2m2x7EXeUuo2VJjot9/5Q7Qdz0lus48V88uxZn48pXSIRRoCBV Ee+efbpiA2ylGaCBfsJGVFLkx2WDiuPnmEcT0o24mlH8xVaayb8jYHkJXt5ibo0H2TwP RR3yah+pBLyVIlvnUcevt0vJzocXXoPCWhwfgiD+1/k176nHN5aDEO9QOf6Kx5BzH/E4 f+vw== X-Gm-Message-State: AOAM530f6QqY4o23V3PU6301Jh61BPyYdHiDZCZX9cgeAONBYYboiED2 JhYqEYuyMK6qYEHBJ8pbZgGXwzsgNW4EWQ== X-Google-Smtp-Source: ABdhPJzkU20fIphNTX2PPQQAxW+TNX9maMZo/mZ7GY2FWS4NTMgRUpdYOuWZ0aP1HC5YemnET1e+lA== X-Received: by 2002:a05:6102:308f:: with SMTP id l15mr3089882vsb.15.1606838731397; Tue, 01 Dec 2020 08:05:31 -0800 (PST) Received: from mail-ua1-f53.google.com (mail-ua1-f53.google.com. [209.85.222.53]) by smtp.gmail.com with ESMTPSA id m123sm378619vsd.17.2020.12.01.08.05.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Dec 2020 08:05:31 -0800 (PST) Received: by mail-ua1-f53.google.com with SMTP id q68so736322uaq.3 for ; Tue, 01 Dec 2020 08:05:30 -0800 (PST) X-Received: by 2002:a9f:3dcc:: with SMTP id e12mr3008143uaj.121.1606838729851; Tue, 01 Dec 2020 08:05:29 -0800 (PST) MIME-Version: 1.0 References: <20201201031015.23314-1-chris.ruehl@gtsys.com.hk> In-Reply-To: <20201201031015.23314-1-chris.ruehl@gtsys.com.hk> From: Doug Anderson Date: Tue, 1 Dec 2020 08:05:18 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] phy: rockchip-emmc: emmc_phy_init() always return 0 To: Chris Ruehl Cc: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner , Ulf Hansson , LKML , Linux ARM , "open list:ARM/Rockchip SoC..." Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Mon, Nov 30, 2020 at 7:10 PM Chris Ruehl wrote: > > rockchip_emmc_phy_init() return variable is not set with the error value > if clk_get() failed. The debug message print 0 on error and the function > always return 0. > Fix it using PTR_ERR(). > > Fixes: 52c0624a10cce phy: rockchip-emmc: Set phyctrl_frqsel based on card clock > > Signed-off-by: Chris Ruehl > --- > drivers/phy/rockchip/phy-rockchip-emmc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockchip/phy-rockchip-emmc.c > index 48e2d75b1004..75faee5c0d27 100644 > --- a/drivers/phy/rockchip/phy-rockchip-emmc.c > +++ b/drivers/phy/rockchip/phy-rockchip-emmc.c > @@ -253,6 +253,7 @@ static int rockchip_emmc_phy_init(struct phy *phy) > */ > rk_phy->emmcclk = clk_get(&phy->dev, "emmcclk"); > if (IS_ERR(rk_phy->emmcclk)) { > + ret = PTR_ERR(rk_phy->emmcclk); I'm pretty sure your patch isn't correct and it would break use cases. Is it fixing some bug that you're aware of, or you found it via code inspection? Specifically: * The big comment block in this function says that the clock is optional and that we're ignoring errors. * The printout in this function is "dbg" level, which is an extra indication that we aren't concerned with these errors. Arguably the code could be made better. If you want to improve it, you could check for just the error we expect if the clock isn't specified (probably -ENODEV, but you should check) and treat all other failures as real errors. -Doug From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD7E4C64E7B for ; Tue, 1 Dec 2020 16:05:39 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5EE192222A for ; Tue, 1 Dec 2020 16:05:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eeiyAd8u"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="S26NKxDQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5EE192222A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tCegbG5iwZ81WYA/iFRIdhmq0WLIPsKtjVUzAtsIOKU=; b=eeiyAd8u16ypSYEGZn+IwziaF UywLIVO3vlPWhklYLjmr6XZB6FgpWT3TdkEp3hQ3Lj7IpWXQjsg88LN0+rbW3csxtir5oecYs5MML wZNOY/mrXvUk570esEsn18Leeo4W5lE8kKEdbcYmGp4f8G0qtH+taiIAZdk9jVTVQGzTshWabYf1o ROioiDeOq1hnv8nCYTHnzXPVXOQM0MydHaK8jBH7Rsj/pg2Ksb+xRYlBJpQt5MOIrEVeN/IyKJJR8 rkLMaVNLTsC69Ds/CBKWohw843MIA3/6KlZaxM0F4pV82zE8UWRlYPUCD1KDXDHD7z8VveL18BDy6 Vl4zpGSnw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk89o-0007c7-0D; Tue, 01 Dec 2020 16:05:36 +0000 Received: from mail-vs1-xe42.google.com ([2607:f8b0:4864:20::e42]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk89l-0007ag-QK for linux-rockchip@lists.infradead.org; Tue, 01 Dec 2020 16:05:34 +0000 Received: by mail-vs1-xe42.google.com with SMTP id x26so1188799vsq.1 for ; Tue, 01 Dec 2020 08:05:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OuJ+iD6xtM+VMtARqwefKzhnGpcfRpOS7XnUWAe2JEY=; b=S26NKxDQQMuZxt+1oFstIH0f+WpADwmUSiWsrMAdTuElMG8Tk8kY59fXqelvjthP2f 8db5WERWrK0YCQ4FqlHnBMH/ZATTA6HxEq1tiNLnrLiqZSw/17r/KXgIXCoHSH+Gy1Ww SMYLtA7y7XlkxaPsi0YpsQTcdqtJX+8n/g450= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OuJ+iD6xtM+VMtARqwefKzhnGpcfRpOS7XnUWAe2JEY=; b=ck+du/uTN9onYUX3P6Z1fsi4TM1v+rAtk356gbLfU5Htw5og5gxacsiZC6BBQe8d49 1WSUt4KEBo6LTew9vYQtbbJSNRxBvxvYtbnTzD7+/cgYSPWZQM7QJxgRUOxTzV2HXePS baJCSvEUvEbONCPBt2osXW/nYMU48StyvP4ypvsUoth+PWDV3lfiJg7R3ou9v8Q6lT0K 63RVRYP1nAr/IdO/4V/XNWEx5y6pAYzr3UcN3FtS/Qaj2SrEwh2HaPm1X1mcP5qTkxMV 0xL1y7Z1Zhxub5UHJbw1tKCdZN1ivFBQX4jxrovsomwfk/QIOVew5syo7NVCahPURg4G pbJQ== X-Gm-Message-State: AOAM5314wWeWo3yNjlBHLy91ixo74BmiiuaynkL3y6cf2ZklEg+i4UgU DG5ij7y2bFeiX9YSft13uCHafSVATnTl5Q== X-Google-Smtp-Source: ABdhPJwRm++kSvRDp0MRj3cQ5dpgUQYb+attJh3JcZRkC/W0DcXvB/vIIlX/SYvFkDRzP7u5GoDdbg== X-Received: by 2002:a05:6102:2148:: with SMTP id h8mr3323020vsg.12.1606838731280; Tue, 01 Dec 2020 08:05:31 -0800 (PST) Received: from mail-ua1-f45.google.com (mail-ua1-f45.google.com. [209.85.222.45]) by smtp.gmail.com with ESMTPSA id g194sm6566vkf.48.2020.12.01.08.05.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Dec 2020 08:05:30 -0800 (PST) Received: by mail-ua1-f45.google.com with SMTP id n18so729433ual.9 for ; Tue, 01 Dec 2020 08:05:30 -0800 (PST) X-Received: by 2002:a9f:3dcc:: with SMTP id e12mr3008143uaj.121.1606838729851; Tue, 01 Dec 2020 08:05:29 -0800 (PST) MIME-Version: 1.0 References: <20201201031015.23314-1-chris.ruehl@gtsys.com.hk> In-Reply-To: <20201201031015.23314-1-chris.ruehl@gtsys.com.hk> From: Doug Anderson Date: Tue, 1 Dec 2020 08:05:18 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] phy: rockchip-emmc: emmc_phy_init() always return 0 To: Chris Ruehl X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201201_110533_901242_0B59008D X-CRM114-Status: GOOD ( 21.50 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Heiko Stuebner , LKML , Kishon Vijay Abraham I , "open list:ARM/Rockchip SoC..." , Vinod Koul , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Hi, On Mon, Nov 30, 2020 at 7:10 PM Chris Ruehl wrote: > > rockchip_emmc_phy_init() return variable is not set with the error value > if clk_get() failed. The debug message print 0 on error and the function > always return 0. > Fix it using PTR_ERR(). > > Fixes: 52c0624a10cce phy: rockchip-emmc: Set phyctrl_frqsel based on card clock > > Signed-off-by: Chris Ruehl > --- > drivers/phy/rockchip/phy-rockchip-emmc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockchip/phy-rockchip-emmc.c > index 48e2d75b1004..75faee5c0d27 100644 > --- a/drivers/phy/rockchip/phy-rockchip-emmc.c > +++ b/drivers/phy/rockchip/phy-rockchip-emmc.c > @@ -253,6 +253,7 @@ static int rockchip_emmc_phy_init(struct phy *phy) > */ > rk_phy->emmcclk = clk_get(&phy->dev, "emmcclk"); > if (IS_ERR(rk_phy->emmcclk)) { > + ret = PTR_ERR(rk_phy->emmcclk); I'm pretty sure your patch isn't correct and it would break use cases. Is it fixing some bug that you're aware of, or you found it via code inspection? Specifically: * The big comment block in this function says that the clock is optional and that we're ignoring errors. * The printout in this function is "dbg" level, which is an extra indication that we aren't concerned with these errors. Arguably the code could be made better. If you want to improve it, you could check for just the error we expect if the clock isn't specified (probably -ENODEV, but you should check) and treat all other failures as real errors. -Doug _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E31D4C64E7A for ; Tue, 1 Dec 2020 16:09:02 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 69D922224A for ; Tue, 1 Dec 2020 16:09:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TtPN+73E"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="S26NKxDQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 69D922224A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=COzTfwiZuaVUzj+88kHxFmEC/jZINq+ElDETQhl6JSc=; b=TtPN+73EdChU15C7s/LvF05xb EMuWhmNo8xO4H76HhYQ8ymXjGWZSqC0O7uHoqJ47x/M9Ec8io8WPxYAtBq1nGjrAYnYRIaJT3WPuF 2wSbCE1i1lOQVK0xNy1FFpBR+c1ij0psfTeqkXHlJoJbj+IagtyZU/ImMs30vcm5yjPkOMMa85dke oqMvaAbm4MUNnUNgMMF1cXmJC1JnccB1JAXVbzB/yt6rZba5yO6OTaKKes6EFxTFMdoHuLB4hKT84 WlxmYNE/QnY19QCb/6Z6fcDNNGD0U73xhRGLa6KX1xWjk+qabsTaKUSHz0Sb1rBrF0UvbeT7r+JuK zKgJEf6JA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk89p-0007cO-8p; Tue, 01 Dec 2020 16:05:37 +0000 Received: from mail-vs1-xe43.google.com ([2607:f8b0:4864:20::e43]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk89m-0007ai-1A for linux-arm-kernel@lists.infradead.org; Tue, 01 Dec 2020 16:05:35 +0000 Received: by mail-vs1-xe43.google.com with SMTP id x26so1188804vsq.1 for ; Tue, 01 Dec 2020 08:05:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OuJ+iD6xtM+VMtARqwefKzhnGpcfRpOS7XnUWAe2JEY=; b=S26NKxDQQMuZxt+1oFstIH0f+WpADwmUSiWsrMAdTuElMG8Tk8kY59fXqelvjthP2f 8db5WERWrK0YCQ4FqlHnBMH/ZATTA6HxEq1tiNLnrLiqZSw/17r/KXgIXCoHSH+Gy1Ww SMYLtA7y7XlkxaPsi0YpsQTcdqtJX+8n/g450= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OuJ+iD6xtM+VMtARqwefKzhnGpcfRpOS7XnUWAe2JEY=; b=gso8bsffzKemu4MnbsXZs3X6RE0g+Bu9d9Z/8tvRjLesJDuWj5tgXW3xSxVRbew5c3 1fl5M1Q3b+U1SLUpxhoGTZe4i2zImeVqFkevyZxL/oiJPwfi1BLM8w+4p//a6h6YSXhJ L9YeMPBDAIjKPbRKLMBkfNZFcYSZss9grL+MUuCaV/HLAbtdvJd3VE3eq+QYcGJqkCb6 poK2+44d4JroUN8rO6obwHscRPUHnCrtOUkDStSf070Ohbdb/tooH03uxrXyvhZH2vme PwCDskpPbwmHvMi4ZPUrBp5qefLs0Z7n0mjqrSLK69oIcWfYZuEVYHjqVsiEj3ulGDQW PF+Q== X-Gm-Message-State: AOAM531wTpjJ2l68017N3Gvy7wz5h3QdHj1wZRUYmzRVav4dwVU0RRis NUF8RZnVxdnEwJ7D7l8sY7jkBM6PS9ggGA== X-Google-Smtp-Source: ABdhPJzVG3rmfXJH5bhxGkK5BZsVDSG386JXaTb9OIDTzKwzIo/9949D9WrDaJzONkBVOQigvvJ/Vw== X-Received: by 2002:a67:fb46:: with SMTP id e6mr1933381vsr.0.1606838731178; Tue, 01 Dec 2020 08:05:31 -0800 (PST) Received: from mail-ua1-f47.google.com (mail-ua1-f47.google.com. [209.85.222.47]) by smtp.gmail.com with ESMTPSA id c21sm376093vsh.31.2020.12.01.08.05.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Dec 2020 08:05:30 -0800 (PST) Received: by mail-ua1-f47.google.com with SMTP id a10so725211uan.12 for ; Tue, 01 Dec 2020 08:05:30 -0800 (PST) X-Received: by 2002:a9f:3dcc:: with SMTP id e12mr3008143uaj.121.1606838729851; Tue, 01 Dec 2020 08:05:29 -0800 (PST) MIME-Version: 1.0 References: <20201201031015.23314-1-chris.ruehl@gtsys.com.hk> In-Reply-To: <20201201031015.23314-1-chris.ruehl@gtsys.com.hk> From: Doug Anderson Date: Tue, 1 Dec 2020 08:05:18 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] phy: rockchip-emmc: emmc_phy_init() always return 0 To: Chris Ruehl X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201201_110534_100013_DAE20309 X-CRM114-Status: GOOD ( 22.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Heiko Stuebner , LKML , Kishon Vijay Abraham I , "open list:ARM/Rockchip SoC..." , Vinod Koul , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On Mon, Nov 30, 2020 at 7:10 PM Chris Ruehl wrote: > > rockchip_emmc_phy_init() return variable is not set with the error value > if clk_get() failed. The debug message print 0 on error and the function > always return 0. > Fix it using PTR_ERR(). > > Fixes: 52c0624a10cce phy: rockchip-emmc: Set phyctrl_frqsel based on card clock > > Signed-off-by: Chris Ruehl > --- > drivers/phy/rockchip/phy-rockchip-emmc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockchip/phy-rockchip-emmc.c > index 48e2d75b1004..75faee5c0d27 100644 > --- a/drivers/phy/rockchip/phy-rockchip-emmc.c > +++ b/drivers/phy/rockchip/phy-rockchip-emmc.c > @@ -253,6 +253,7 @@ static int rockchip_emmc_phy_init(struct phy *phy) > */ > rk_phy->emmcclk = clk_get(&phy->dev, "emmcclk"); > if (IS_ERR(rk_phy->emmcclk)) { > + ret = PTR_ERR(rk_phy->emmcclk); I'm pretty sure your patch isn't correct and it would break use cases. Is it fixing some bug that you're aware of, or you found it via code inspection? Specifically: * The big comment block in this function says that the clock is optional and that we're ignoring errors. * The printout in this function is "dbg" level, which is an extra indication that we aren't concerned with these errors. Arguably the code could be made better. If you want to improve it, you could check for just the error we expect if the clock isn't specified (probably -ENODEV, but you should check) and treat all other failures as real errors. -Doug _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel