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] [day] [month] [year] [list]
Message-ID: <4bd8b33b-cb48-9cc7-671b-3b1431af6858@gmail.com>
Date:   Mon, 12 Sep 2022 09:25:26 -0700
From:   Florian Fainelli <f.fainelli@...il.com>
To:     cgel.zte@...il.com, woojung.huh@...rochip.com
Cc:     UNGLinuxDriver@...rochip.com, andrew@...n.ch,
        vivien.didelot@...il.com, olteanv@...il.com, davem@...emloft.net,
        edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
        linux@...linux.org.uk, netdev@...r.kernel.org,
        Xu Panda <xu.panda@....com.cn>, Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH V2 linux-next] net: dsa: microchip: remove the unneeded
 result variable



On 9/12/2022 1:07 AM, cgel.zte@...il.com wrote:
> From: Xu Panda <xu.panda@....com.cn>
> 
> Return the value ksz_get_xmii() directly instead of storing it in
> another redundant variable.
> 
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Xu Panda <xu.panda@....com.cn>

Reviewed-by: Florian Fainelli <f.fainelli@...il.com>

One comment below:

> ---
>   drivers/net/dsa/microchip/ksz9477.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
> index 42d7e4c12459..ab7245b24493 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c
> @@ -884,7 +884,6 @@ void ksz9477_port_mirror_del(struct ksz_device *dev, int port,
> 
>   static phy_interface_t ksz9477_get_interface(struct ksz_device *dev, int port)
>   {
> -       phy_interface_t interface;
>          bool gbit;
> 
>          if (dev->info->internal_phy[port])
> @@ -892,9 +891,7 @@ static phy_interface_t ksz9477_get_interface(struct ksz_device *dev, int port)
> 
>          gbit = ksz_get_gbit(dev, port);


Same logic applies here, you could fold ksz_get_gbit()'s return value 
into the tail call, and once you do that, this begs the question of how 
specific the KSZ9477 implementation has really become..
> 
> -       interface = ksz_get_xmii(dev, port, gbit);
> -
> -       return interface;
> +       return ksz_get_xmii(dev, port, gbit);
>   }
> 
>   static void ksz9477_port_mmd_write(struct ksz_device *dev, int port,

-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ