All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 linux-next] net: dsa: microchip: remove the unneeded result variable
@ 2022-09-12  8:07 cgel.zte
  2022-09-12 16:25 ` Florian Fainelli
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-09-12  8:07 UTC (permalink / raw)
  To: woojung.huh
  Cc: UNGLinuxDriver, andrew, vivien.didelot, f.fainelli, olteanv,
	davem, edumazet, kuba, pabeni, linux, netdev, Xu Panda,
	Zeal Robot

From: Xu Panda <xu.panda@zte.com.cn>

Return the value ksz_get_xmii() directly instead of storing it in
another redundant variable.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
---
 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);

-       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,
-- 
2.15.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH V2 linux-next] net: dsa: microchip: remove the unneeded result variable
  2022-09-12  8:07 [PATCH V2 linux-next] net: dsa: microchip: remove the unneeded result variable cgel.zte
@ 2022-09-12 16:25 ` Florian Fainelli
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2022-09-12 16:25 UTC (permalink / raw)
  To: cgel.zte, woojung.huh
  Cc: UNGLinuxDriver, andrew, vivien.didelot, olteanv, davem, edumazet,
	kuba, pabeni, linux, netdev, Xu Panda, Zeal Robot



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

Reviewed-by: Florian Fainelli <f.fainelli@gmail.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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-12 16:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-12  8:07 [PATCH V2 linux-next] net: dsa: microchip: remove the unneeded result variable cgel.zte
2022-09-12 16:25 ` Florian Fainelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.