From: Sean Anderson <seanga2@gmail.com>
To: Damien Le Moal <Damien.LeMoal@wdc.com>,
Dan Carpenter <dan.carpenter@oracle.com>,
"kbuild@lists.01.org" <kbuild@lists.01.org>
Cc: "lkp@intel.com" <lkp@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Palmer Dabbelt <palmerdabbelt@google.com>,
Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [kbuild] drivers/pinctrl/pinctrl-k210.c:970 k210_fpioa_probe() warn: 'pdata->clk' not released on lines: 962,968.
Date: Mon, 2 Aug 2021 10:17:24 -0400 [thread overview]
Message-ID: <68285071-073b-6d84-0650-02e77965c878@gmail.com> (raw)
In-Reply-To: <DM6PR04MB708187FE0B622791011BEEB7E7EE9@DM6PR04MB7081.namprd04.prod.outlook.com>
On 8/1/21 6:50 PM, Damien Le Moal wrote:
> On 2021/07/30 22:46, Dan Carpenter wrote:
>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head: 764a5bc89b12b82c18ce7ca5d7c1b10dd748a440
>> commit: d4c34d09ab03e1e631fe195ddf35365a1273be9c pinctrl: Add RISC-V Canaan Kendryte K210 FPIOA driver
>> config: riscv-randconfig-m031-20210730 (attached as .config)
>> compiler: riscv64-linux-gcc (GCC) 10.3.0
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>>
>> smatch warnings:
>> drivers/pinctrl/pinctrl-k210.c:970 k210_fpioa_probe() warn: 'pdata->clk' not released on lines: 962,968.
>>
>> vim +970 drivers/pinctrl/pinctrl-k210.c
>>
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 925 static int k210_fpioa_probe(struct platform_device *pdev)
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 926 {
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 927 struct device *dev = &pdev->dev;
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 928 struct device_node *np = dev->of_node;
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 929 struct k210_fpioa_data *pdata;
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 930 int ret;
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 931
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 932 dev_info(dev, "K210 FPIOA pin controller\n");
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 933
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 934 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 935 if (!pdata)
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 936 return -ENOMEM;
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 937
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 938 pdata->dev = dev;
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 939 platform_set_drvdata(pdev, pdata);
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 940
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 941 pdata->fpioa = devm_platform_ioremap_resource(pdev, 0);
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 942 if (IS_ERR(pdata->fpioa))
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 943 return PTR_ERR(pdata->fpioa);
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 944
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 945 pdata->clk = devm_clk_get(dev, "ref");
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 946 if (IS_ERR(pdata->clk))
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 947 return PTR_ERR(pdata->clk);
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 948
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 949 ret = clk_prepare_enable(pdata->clk);
>> ^^^^^^^^^^^^^^^^^^
>>
>>
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 950 if (ret)
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 951 return ret;
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 952
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 953 pdata->pclk = devm_clk_get_optional(dev, "pclk");
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 954 if (!IS_ERR(pdata->pclk))
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 955 clk_prepare_enable(pdata->pclk);
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> No error handling
>>
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 956
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 957 pdata->sysctl_map =
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 958 syscon_regmap_lookup_by_phandle_args(np,
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 959 "canaan,k210-sysctl-power",
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 960 1, &pdata->power_offset);
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 961 if (IS_ERR(pdata->sysctl_map))
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 962 return PTR_ERR(pdata->sysctl_map);
>>
>> Do we need to clk_unprepare_disable() before returning?
>>
>>
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 963
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 964 k210_fpioa_init_ties(pdata);
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 965
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 966 pdata->pctl = pinctrl_register(&k210_pinctrl_desc, dev, (void *)pdata);
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 967 if (IS_ERR(pdata->pctl))
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 968 return PTR_ERR(pdata->pctl);
>>
>> Here too.
>
> I can add the clk_unprepare_disable() call to avoid the warning, but that is
> rather pointless as the system will not boot at all if there is an error here.
> Thoughts ?
IMO, you should still handle the error so the user gets some warning
about not being able to enable the clock instead of crashing at some
later point.
--Sean
>
>>
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 969
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 @970 return 0;
>> d4c34d09ab03e1 Damien Le Moal 2021-01-12 971 }
>>
>> ---
>> 0-DAY CI Kernel Test Service, Intel Corporation
>> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>>
>> _______________________________________________
>> kbuild mailing list -- kbuild@lists.01.org
>> To unsubscribe send an email to kbuild-leave@lists.01.org
>>
>>
>
>
prev parent reply other threads:[~2021-08-02 14:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-30 13:45 [kbuild] drivers/pinctrl/pinctrl-k210.c:970 k210_fpioa_probe() warn: 'pdata->clk' not released on lines: 962,968 Dan Carpenter
2021-08-01 22:50 ` Damien Le Moal
2021-08-02 12:55 ` Dan Carpenter
2021-08-02 14:17 ` Sean Anderson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=68285071-073b-6d84-0650-02e77965c878@gmail.com \
--to=seanga2@gmail.com \
--cc=Damien.LeMoal@wdc.com \
--cc=dan.carpenter@oracle.com \
--cc=kbuild@lists.01.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=palmerdabbelt@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).