All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] net: ethernet: ti: am65-cpsw-nuss: restore vlan configuration while down/up
Date: Wed, 3 Dec 2025 10:23:48 +0300	[thread overview]
Message-ID: <aS_lhMwppbDHoEcX@stanley.mountain> (raw)

Hello Grygorii Strashko,

Commit 7bcffde02152 ("net: ethernet: ti: am65-cpsw-nuss: restore vlan
configuration while down/up") from Jun 26, 2020 (linux-next), leads
to the following Smatch static checker warning:

	drivers/net/ethernet/ti/am65-cpsw-nuss.c:319 am65_cpsw_nuss_ndo_slave_add_vid()
	warn: duplicate zero check 'vid' (previous on line 311)

drivers/net/ethernet/ti/am65-cpsw-nuss.c
    300 static int am65_cpsw_nuss_ndo_slave_add_vid(struct net_device *ndev,
    301                                             __be16 proto, u16 vid)
    302 {
    303         struct am65_cpsw_common *common = am65_ndev_to_common(ndev);
    304         struct am65_cpsw_port *port = am65_ndev_to_port(ndev);
    305         u32 port_mask, unreg_mcast = 0;
    306         int ret;
    307 
    308         if (!common->is_emac_mode)
    309                 return 0;
    310 
    311         if (!netif_running(ndev) || !vid)
    312                 return 0;

If vid is zero we return here.

    313 
    314         ret = pm_runtime_resume_and_get(common->dev);
    315         if (ret < 0)
    316                 return ret;
    317 
    318         port_mask = BIT(port->port_id) | ALE_PORT_HOST;
--> 319         if (!vid)
    320                 unreg_mcast = port_mask;

Which means that this is dead code.  unreg_mcast is always going to be
zero.

    321         dev_info(common->dev, "Adding vlan %d to vlan filter\n", vid);
    322         ret = cpsw_ale_vlan_add_modify(common->ale, vid, port_mask,
    323                                        unreg_mcast, port_mask, 0);
    324 
    325         pm_runtime_put(common->dev);
    326         return ret;
    327 }

regards,
dan carpenter

             reply	other threads:[~2025-12-03  7:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-03  7:23 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-04-20  8:27 [bug report] net: ethernet: ti: am65-cpsw-nuss: restore vlan configuration while down/up Dan Carpenter

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=aS_lhMwppbDHoEcX@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=grygorii.strashko@ti.com \
    --cc=kernel-janitors@vger.kernel.org \
    /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 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.