Skip to contentSkip to conversation

net: ethernet: renesas: Add support for "Ethernet Switch"

bug report Dan Carpenter 3 participants 3 messages Nov 15, 2022

lore
Share & tools
lore
#0 lore raw

Hello Yoshihiro Shimoda,

The patch 3590918b5d07: "net: ethernet: renesas: Add support for "Ethernet Switch"" from Oct 31, 2022, leads to the following Smatch static checker warning:

drivers/net/ethernet/renesas/rswitch.c:1717 rswitch_init()
warn: '%pM' cannot be followed by 'n'

drivers/net/ethernet/renesas/rswitch.c

    1706 
    1707         for (i = 0; i < RSWITCH_NUM_PORTS; i++) {
    1708                 err = register_netdev(priv->rdev[i]->ndev);
    1709                 if (err) {
    1710                         for (i--; i >= 0; i--)
    1711                                 unregister_netdev(priv->rdev[i]->ndev);
    1712                         goto err_register_netdev;
    1713                 }
    1714         }
    1715 
    1716         for (i = 0; i < RSWITCH_NUM_PORTS; i++)
--> 1717                 netdev_info(priv->rdev[i]->ndev, "MAC address %pMn",
                                                                          ^

This 'n' doesn't make sense. See mac_address_string() for more details.

    1718                             priv->rdev[i]->ndev->dev_addr);
    1719 
    1720         return 0;
    1721 
    1722 err_register_netdev:
    1723         rswitch_ether_port_deinit_all(priv);
    1724 
    1725 err_ether_port_init_all:
    1726         rswitch_gwca_hw_deinit(priv);
    1727 
    1728 err_gwca_hw_init:
    1729 err_gwca_request_irq:
    1730         rcar_gen4_ptp_unregister(priv->ptp_priv);
    1731 
    1732 err_ptp_register:
    1733         for (i = 0; i < RSWITCH_NUM_PORTS; i++)
    1734                 rswitch_device_free(priv, i);
    1735 
    1736 err_device_alloc:
    1737         rswitch_gwca_desc_free(priv);
    1738 
    1739         return err;
    1740 }

regards,
dan carpenter

#1 lore raw

Hi Dan,

Quoted 21 lines · Dan Carpenter

The patch 3590918b5d07: "net: ethernet: renesas: Add support for "Ethernet Switch"" from Oct 31, 2022, leads to the following Smatch static checker warning:

drivers/net/ethernet/renesas/rswitch.c:1717 rswitch_init()
warn: '%pM' cannot be followed by 'n'

drivers/net/ethernet/renesas/rswitch.c

    1706
    1707         for (i = 0; i < RSWITCH_NUM_PORTS; i++) {
    1708                 err = register_netdev(priv->rdev[i]->ndev);
    1709                 if (err) {
    1710                         for (i--; i >= 0; i--)
    1711                                 unregister_netdev(priv->rdev[i]->ndev);
    1712                         goto err_register_netdev;
    1713                 }
    1714         }
    1715
    1716         for (i = 0; i < RSWITCH_NUM_PORTS; i++)
--> 1717                 netdev_info(priv->rdev[i]->ndev, "MAC address %pMn",
                                                                          ^
Quoted 1 line

This 'n' doesn't make sense. See mac_address_string() for more details.

I guess that should be "\n"?

Quoted 1 line
    1718                             priv->rdev[i]->ndev->dev_addr);

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#2 lore raw

Hi,

Quoted 27 lines

From: Geert Uytterhoeven, Sent: Tuesday, November 15, 2022 11:23 PM

Hi Dan,

Quoted 22 lines · Dan Carpenter

The patch 3590918b5d07: "net: ethernet: renesas: Add support for "Ethernet Switch"" from Oct 31, 2022, leads to the following Smatch static checker warning:

drivers/net/ethernet/renesas/rswitch.c:1717 rswitch_init()
warn: '%pM' cannot be followed by 'n'

drivers/net/ethernet/renesas/rswitch.c

    1706
    1707         for (i = 0; i < RSWITCH_NUM_PORTS; i++) {
    1708                 err = register_netdev(priv->rdev[i]->ndev);
    1709                 if (err) {
    1710                         for (i--; i >= 0; i--)
    1711                                 unregister_netdev(priv->rdev[i]->ndev);
    1712                         goto err_register_netdev;
    1713                 }
    1714         }
    1715
    1716         for (i = 0; i < RSWITCH_NUM_PORTS; i++)
--> 1717                 netdev_info(priv->rdev[i]->ndev, "MAC address %pMn",
                                                                          ^

This 'n' doesn't make sense. See mac_address_string() for more details.

Dan, thank you for the report!

Quoted 1 line

I guess that should be "\n"?

Geert-san, thank you for the suggestion. You're correct. I confirmed that "\n" resolved the smatch warning. I'll make/submit a patch for this issue.

Best regards,
Yoshihiro Shimoda

Quoted 12 lines
Quoted 1 line
    1718                             priv->rdev[i]->ndev->dev_addr);

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds