lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e238122b-5df1-451b-905a-0dfbd457dd08@intel.com>
Date: Wed, 28 Aug 2024 15:14:51 -0700
From: Jacob Keller <jacob.e.keller@...el.com>
To: Hongbo Li <lihongbo22@...wei.com>, <yisen.zhuang@...wei.com>,
	<salil.mehta@...wei.com>, <davem@...emloft.net>, <edumazet@...gle.com>,
	<kuba@...nel.org>, <pabeni@...hat.com>
CC: <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next] net: hns: Use IS_ERR_OR_NULL() helper function



On 8/28/2024 5:23 AM, Hongbo Li wrote:
> Use the IS_ERR_OR_NULL() helper instead of open-coding a
> NULL and an error pointer checks to simplify the code and
> improve readability.
> 
> Signed-off-by: Hongbo Li <lihongbo22@...wei.com>
> ---
>  drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
> index f75668c47935..53e0da0bfbed 100644
> --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
> +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
> @@ -734,7 +734,7 @@ hns_mac_register_phydev(struct mii_bus *mdio, struct hns_mac_cb *mac_cb,
>  		return -ENODATA;
>  
>  	phy = get_phy_device(mdio, addr, is_c45);
> -	if (!phy || IS_ERR(phy))
> +	if (IS_ERR_OR_NULL(phy))
>  		return -EIO;
>  

This does collapse any error from get_phy_device into -EIO, when you
should specifically check and return the PTR_ERR value. I'm not sure how
useful that is, and feels like a separate cleanup.

Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>


>  	phy->irq = mdio->irq[addr];

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ