Message ID | 20230414122253.3171524-1-trix@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp340391vqo; Fri, 14 Apr 2023 05:24:47 -0700 (PDT) X-Google-Smtp-Source: AKy350Y/hjJFV3zbT1gMRJ3lUpYFKRIQBiO1lzwPvLwtZbwdV9SYU11NCG8uDyx10Z8WYO/EWSwS X-Received: by 2002:a05:6a00:1a93:b0:627:e701:8ca9 with SMTP id e19-20020a056a001a9300b00627e7018ca9mr7936970pfv.2.1681475086618; Fri, 14 Apr 2023 05:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681475086; cv=none; d=google.com; s=arc-20160816; b=Xj8jbIguzCNkRcCgw4+IK2mQ/9UW4AMxqDP1NEdpsm9VoZNl8AuxhAoABcgXEUt5RI XTdFXxUEHtyTlF+bAEuZUGQZOXP3+njDEI9fBfSLD7KqkwbYBCGkwwS0pk0yZMhYqDz8 0Wl5FKqab2uIhRrXO4nwErIB/LgZ+gm5SNLyOfpDQw/EdBRHkC5ge+a5vOUVnzuc1fYu wsR52hAgQANzNo1VEx2MhHfAOo7KHpkCYcHfbs5Dn/5ay3nootbrxPjEOETSwl7ME0LN cVDJSG0Z2pVC1rIBBHGQkusLSRX2L1P1KY4X8Ieq/jzJf6rox11NcI8keD8fhrMc0YrK SjVg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=yPCGffG6qbUGI7F6FTErQ0LH3cHGPkEEbnsErQvfFxw=; b=FvT/JposLElWUpIPY2b5PVEp1LhPHKXf1FAN0edgndPig/zGaiKSw/o4S3+xPrWQKA QVxzN5ajbixGN5+6bwmyf57Sw/xjqCvw0LZhLzgWepRU1wcZ/zt19OIdYlMPucemVG+H rcjW5IepnZWIujAtKeIq8clDmvYPcBVFoVRo35KxPDpyyLYBDjSmaWtNmHiTgEdmCKWl HweLJa0VRhh8RiIBUzrcz6wkLpg7ymlRAZh/WPSNU0KZLRk+NQxEYj/KEMXTLweFCULe IFT1FNmp/9O8WFUjmXdD1JkXdsZ0OFbGzmLMtg8sdIggIoKdCWgdnZnFfERquqwiSfhu Y7aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VxDNuOmb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j67-20020a625546000000b0063473a51539si4051193pfb.398.2023.04.14.05.24.31; Fri, 14 Apr 2023 05:24:46 -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=@redhat.com header.s=mimecast20190719 header.b=VxDNuOmb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230332AbjDNMYD (ORCPT <rfc822;leviz.kernel.dev@gmail.com> + 99 others); Fri, 14 Apr 2023 08:24:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230135AbjDNMYB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 14 Apr 2023 08:24:01 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91FFBB769 for <linux-kernel@vger.kernel.org>; Fri, 14 Apr 2023 05:22:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681474978; 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; bh=yPCGffG6qbUGI7F6FTErQ0LH3cHGPkEEbnsErQvfFxw=; b=VxDNuOmb7VxXsybndgVT2rHYevuRpQ2TWuIeHX4Klp/+Ut8vUHUeVAlru9ScMZ7Oaj7NfI zzu27G1j0zEtEWjrNynXGCl/BHFMV4eUt0NVNvV2ITjXi+GP+cwib+geSyv2f328nsBR/t kqWV6dlJUZFc3IC+Uxu0AvqpUrQVOK8= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-211-jKD2-NPYMxSMrRLBwR7aaw-1; Fri, 14 Apr 2023 08:22:57 -0400 X-MC-Unique: jKD2-NPYMxSMrRLBwR7aaw-1 Received: by mail-qt1-f200.google.com with SMTP id o4-20020ac87c44000000b003e38726ec8bso12823764qtv.23 for <linux-kernel@vger.kernel.org>; Fri, 14 Apr 2023 05:22:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681474977; x=1684066977; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yPCGffG6qbUGI7F6FTErQ0LH3cHGPkEEbnsErQvfFxw=; b=huA9HxnWu6Na4bmBOjkrTF8rzEOq+K60CimdUeDDOVOHKM6d3jGYaK+aLhQN6rP0pO bTJb+3u6dQt8P/8hiYZtsCr1j5tQr6wH4i94mx8zbdVPEacDtihBFVLwKX8PkyWNmIhF X+GMgGbPcxjgpGl+e5A946MbOmHKg6cP0qoHsvqGyGO4D+hgo3osZUZUSzB8cM5ds72a FfN/b9GSEwKAKuxbDyI/tlfTYKg5yb8Xibpl/2p7joNj1ock6znz6MelRROtjg0xn3mt F1ghcNS+UBpSulqivWht/4cKg4jA4N1d0mfXH0/3oBMMSjugZwtoZLyzm9jWYrDIlyy/ DIKA== X-Gm-Message-State: AAQBX9c/s+hdqcivFPK+He8iFEZsgnKCm1Syb/gkxqN2hW85KGOAl2Zm SMsm9HRdk0tgYwGLj6FV/BAst9ru1+InJBGiYQQVuzmQ5bsdp0WXu5XHSMskM7ueOPZq3sLn0Wt U4nvUCbceMCtmq+gPa0rcFbb+ X-Received: by 2002:ac8:5945:0:b0:3e4:e2fa:66b0 with SMTP id 5-20020ac85945000000b003e4e2fa66b0mr7771650qtz.29.1681474977143; Fri, 14 Apr 2023 05:22:57 -0700 (PDT) X-Received: by 2002:ac8:5945:0:b0:3e4:e2fa:66b0 with SMTP id 5-20020ac85945000000b003e4e2fa66b0mr7771633qtz.29.1681474976909; Fri, 14 Apr 2023 05:22:56 -0700 (PDT) Received: from dell-per740-01.7a2m.lab.eng.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id r4-20020ac85e84000000b003e302c1f498sm1193420qtx.37.2023.04.14.05.22.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 05:22:56 -0700 (PDT) From: Tom Rix <trix@redhat.com> To: chunkuang.hu@kernel.org, p.zabel@pengutronix.de, chunfeng.yun@mediatek.com, vkoul@kernel.org, kishon@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, nathan@kernel.org, ndesaulniers@google.com, granquet@baylibre.com Cc: dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Tom Rix <trix@redhat.com> Subject: [PATCH] phy: mediatek: fix returning garbage Date: Fri, 14 Apr 2023 08:22:53 -0400 Message-Id: <20230414122253.3171524-1-trix@redhat.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763154420522626187?= X-GMAIL-MSGID: =?utf-8?q?1763154420522626187?= |
Series |
phy: mediatek: fix returning garbage
|
|
Commit Message
Tom Rix
April 14, 2023, 12:22 p.m. UTC
clang reports
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable
'ret' is uninitialized when used here [-Werror,-Wuninitialized]
if (ret)
^~~
ret should have been set by the preceding call to mtk_hdmi_pll_set_hw.
Fixes: 45810d486bb4 ("phy: mediatek: add support for phy-mtk-hdmi-mt8195")
Signed-off-by: Tom Rix <trix@redhat.com>
---
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Comments
On 14/04/2023 14:22, Tom Rix wrote: > clang reports > drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable > 'ret' is uninitialized when used here [-Werror,-Wuninitialized] > if (ret) > ^~~ > ret should have been set by the preceding call to mtk_hdmi_pll_set_hw. > > Fixes: 45810d486bb4 ("phy: mediatek: add support for phy-mtk-hdmi-mt8195") > Signed-off-by: Tom Rix <trix@redhat.com> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> > --- > drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c > index abfc077fb0a8..c63294e451d6 100644 > --- a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c > +++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c > @@ -292,9 +292,9 @@ static int mtk_hdmi_pll_calc(struct mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw, > if (!(digital_div <= 32 && digital_div >= 1)) > return -EINVAL; > > - mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low, > - PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv, > - txposdiv, digital_div); > + ret = mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low, > + PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv, > + txposdiv, digital_div); > if (ret) > return -EINVAL; >
On 14/04/2023 17:43, Matthias Brugger wrote: > > > On 14/04/2023 14:22, Tom Rix wrote: >> clang reports >> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable >> 'ret' is uninitialized when used here [-Werror,-Wuninitialized] >> if (ret) >> ^~~ >> ret should have been set by the preceding call to mtk_hdmi_pll_set_hw. >> >> Fixes: 45810d486bb4 ("phy: mediatek: add support for phy-mtk-hdmi-mt8195") >> Signed-off-by: Tom Rix <trix@redhat.com> > > Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> > Please also add Reported-by: Linux Kernel Functional Testing <lkft@linaro.org> see CA+G9fYu4o0-ZKSthi7kdCjz_kFazZS-rn17Z2NPz3=1Oayr9cw@mail.gmail.com Regards, Matthias >> --- >> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c >> b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c >> index abfc077fb0a8..c63294e451d6 100644 >> --- a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c >> +++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c >> @@ -292,9 +292,9 @@ static int mtk_hdmi_pll_calc(struct mtk_hdmi_phy >> *hdmi_phy, struct clk_hw *hw, >> if (!(digital_div <= 32 && digital_div >= 1)) >> return -EINVAL; >> - mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low, >> - PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv, >> - txposdiv, digital_div); >> + ret = mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low, >> + PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv, >> + txposdiv, digital_div); >> if (ret) >> return -EINVAL;
On Fri, Apr 14, 2023 at 08:22:53AM -0400, Tom Rix wrote: > clang reports > drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable > 'ret' is uninitialized when used here [-Werror,-Wuninitialized] > if (ret) > ^~~ > ret should have been set by the preceding call to mtk_hdmi_pll_set_hw. > > Fixes: 45810d486bb4 ("phy: mediatek: add support for phy-mtk-hdmi-mt8195") > Signed-off-by: Tom Rix <trix@redhat.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Angelo brought up a good point on another patch to fix this issue that we should probably be returning ret instead of unconditionally returning -EINVAL but it sounds like it does not really matter at the moment since mtk_hdmi_pll_set_hw() can only return -EINVAL or 0. https://lore.kernel.org/ada769e0-0141-634f-3753-eb3a50f0eee3@collabora.com/ > --- > drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c > index abfc077fb0a8..c63294e451d6 100644 > --- a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c > +++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c > @@ -292,9 +292,9 @@ static int mtk_hdmi_pll_calc(struct mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw, > if (!(digital_div <= 32 && digital_div >= 1)) > return -EINVAL; > > - mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low, > - PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv, > - txposdiv, digital_div); > + ret = mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low, > + PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv, > + txposdiv, digital_div); > if (ret) > return -EINVAL; > > -- > 2.27.0 >
Il 14/04/23 14:22, Tom Rix ha scritto: > clang reports > drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable > 'ret' is uninitialized when used here [-Werror,-Wuninitialized] > if (ret) > ^~~ > ret should have been set by the preceding call to mtk_hdmi_pll_set_hw. > > Fixes: 45810d486bb4 ("phy: mediatek: add support for phy-mtk-hdmi-mt8195") > Signed-off-by: Tom Rix <trix@redhat.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
On 14-04-23, 08:22, Tom Rix wrote: > clang reports > drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable > 'ret' is uninitialized when used here [-Werror,-Wuninitialized] > if (ret) > ^~~ > ret should have been set by the preceding call to mtk_hdmi_pll_set_hw. I have applied "phy: mediatek: hdmi: mt8195: fix uninitialized variable usage in pll_calc"
On 05/05/2023 11:28, Vinod Koul wrote: > On 14-04-23, 08:22, Tom Rix wrote: >> clang reports >> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable >> 'ret' is uninitialized when used here [-Werror,-Wuninitialized] >> if (ret) >> ^~~ >> ret should have been set by the preceding call to mtk_hdmi_pll_set_hw. > > I have applied "phy: mediatek: hdmi: mt8195: fix uninitialized variable > usage in pll_calc" Thanks Vinod, that was on my list for today as well. I was a bit puzzled because you took the patch that added it, but I wasn't sure if you would take the fix. How do you want to handle things like this in the future? Regards, Matthias
On 05-05-23, 17:37, Matthias Brugger wrote: > > > On 05/05/2023 11:28, Vinod Koul wrote: > > On 14-04-23, 08:22, Tom Rix wrote: > > > clang reports > > > drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable > > > 'ret' is uninitialized when used here [-Werror,-Wuninitialized] > > > if (ret) > > > ^~~ > > > ret should have been set by the preceding call to mtk_hdmi_pll_set_hw. > > > > I have applied "phy: mediatek: hdmi: mt8195: fix uninitialized variable > > usage in pll_calc" > > Thanks Vinod, that was on my list for today as well. I was a bit puzzled > because you took the patch that added it, but I wasn't sure if you would > take the fix. How do you want to handle things like this in the future? Fixes should be sent as Fixes patch
On 08/05/2023 09:48, Vinod Koul wrote: > On 05-05-23, 17:37, Matthias Brugger wrote: >> >> >> On 05/05/2023 11:28, Vinod Koul wrote: >>> On 14-04-23, 08:22, Tom Rix wrote: >>>> clang reports >>>> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable >>>> 'ret' is uninitialized when used here [-Werror,-Wuninitialized] >>>> if (ret) >>>> ^~~ >>>> ret should have been set by the preceding call to mtk_hdmi_pll_set_hw. >>> >>> I have applied "phy: mediatek: hdmi: mt8195: fix uninitialized variable >>> usage in pll_calc" >> >> Thanks Vinod, that was on my list for today as well. I was a bit puzzled >> because you took the patch that added it, but I wasn't sure if you would >> take the fix. How do you want to handle things like this in the future? > > Fixes should be sent as Fixes patch > I'm not sure what do you mean. Patch subject includes the word fix and the patch has a fixes tag. What was missing here? Does this mean you will take fixes for this driver in the future or do you want me to take care of them? Regards, Matthias
On 08-05-23, 10:24, Matthias Brugger wrote: > > > On 08/05/2023 09:48, Vinod Koul wrote: > > On 05-05-23, 17:37, Matthias Brugger wrote: > > > > > > > > > On 05/05/2023 11:28, Vinod Koul wrote: > > > > On 14-04-23, 08:22, Tom Rix wrote: > > > > > clang reports > > > > > drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:298:6: error: variable > > > > > 'ret' is uninitialized when used here [-Werror,-Wuninitialized] > > > > > if (ret) > > > > > ^~~ > > > > > ret should have been set by the preceding call to mtk_hdmi_pll_set_hw. > > > > > > > > I have applied "phy: mediatek: hdmi: mt8195: fix uninitialized variable > > > > usage in pll_calc" > > > > > > Thanks Vinod, that was on my list for today as well. I was a bit puzzled > > > because you took the patch that added it, but I wasn't sure if you would > > > take the fix. How do you want to handle things like this in the future? > > > > Fixes should be sent as Fixes patch > > > > I'm not sure what do you mean. Patch subject includes the word fix and the > patch has a fixes tag. What was missing here? > > Does this mean you will take fixes for this driver in the future or do you > want me to take care of them? Yes I would take the fixes as well for the drivers
diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c index abfc077fb0a8..c63294e451d6 100644 --- a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c +++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c @@ -292,9 +292,9 @@ static int mtk_hdmi_pll_calc(struct mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw, if (!(digital_div <= 32 && digital_div >= 1)) return -EINVAL; - mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low, - PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv, - txposdiv, digital_div); + ret = mtk_hdmi_pll_set_hw(hw, PLL_PREDIV, fbkdiv_high, fbkdiv_low, + PLL_FBKDIV_HS3, posdiv1, posdiv2, txprediv, + txposdiv, digital_div); if (ret) return -EINVAL;