From: Thierry Reding <thierry.reding@gmail.com>
To: kernel test robot <lkp@intel.com>
Cc: Tiezhu Yang <yangtiezhu@loongson.cn>,
kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
Vinod Koul <vkoul@kernel.org>, Heiko Stuebner <heiko@sntech.de>,
Kishon Vijay Abraham I <kishon@ti.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
linux-tegra@vger.kernel.org
Subject: Re: [PATCH] phy: fix ptr_ret.cocci warnings
Date: Tue, 17 Nov 2020 14:28:09 +0100 [thread overview]
Message-ID: <20201117132809.GA2589875@ulmo> (raw)
In-Reply-To: <20201116230032.GA34534@8312513de428>
[-- Attachment #1: Type: text/plain, Size: 2103 bytes --]
On Tue, Nov 17, 2020 at 07:00:32AM +0800, kernel test robot wrote:
> From: kernel test robot <lkp@intel.com>
>
> drivers/phy/tegra/phy-tegra194-p2u.c:95:1-3: WARNING: PTR_ERR_OR_ZERO can be used
>
>
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
>
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
>
> Fixes: 133552bf03ed ("phy: Remove CONFIG_ARCH_* check for related subdir in Makefile")
> CC: Tiezhu Yang <yangtiezhu@loongson.cn>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>
> ---
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 09162bc32c880a791c6c0668ce0745cf7958f576
> commit: 133552bf03edbe3892767a4b64c56e3bed746374 phy: Remove CONFIG_ARCH_* check for related subdir in Makefile
>
> phy-tegra194-p2u.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
A similar patch was recently sent out against the pci-tegra driver. That
was perhaps the third time or so that it happened and both the Bjorn
(the PCI maintainer) and I have agreed multiple times in the past that
this isn't an actual improvement.
There are two reasons why I think this is actually worse than the
original: 1) this doesn't look like regular error handling and therefore
becomes more difficult to read and 2) if we ever need to add code
between the devm_of_phy_provider_register() and the final successful
return, we need to go and effectively revert this patch again.
I wonder if there's enough consensus that PTR_ERR_OR_ZERO() is really
that useful.
Thierry
>
> --- a/drivers/phy/tegra/phy-tegra194-p2u.c
> +++ b/drivers/phy/tegra/phy-tegra194-p2u.c
> @@ -92,10 +92,7 @@ static int tegra_p2u_probe(struct platfo
> phy_set_drvdata(generic_phy, phy);
>
> phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
> - if (IS_ERR(phy_provider))
> - return PTR_ERR(phy_provider);
> -
> - return 0;
> + return PTR_ERR_OR_ZERO(phy_provider);
> }
>
> static const struct of_device_id tegra_p2u_id_table[] = {
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2020-11-17 13:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <202011170710.Dsd9lxrR-lkp@intel.com>
2020-11-16 23:00 ` [PATCH] phy: fix ptr_ret.cocci warnings kernel test robot
2020-11-17 13:28 ` Thierry Reding [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=20201117132809.GA2589875@ulmo \
--to=thierry.reding@gmail.com \
--cc=heiko@sntech.de \
--cc=jonathanh@nvidia.com \
--cc=kbuild-all@lists.01.org \
--cc=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=lkp@intel.com \
--cc=vkoul@kernel.org \
--cc=yangtiezhu@loongson.cn \
/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).