* [frank-w-bpi-r2-4.14:7.1-rc 124/162] drivers/net/ethernet/mediatek/mtk_eth_soc.c:5559:18: sparse: sparse: unsigned value that used to be signed checked against zero?
@ 2026-05-09 22:53 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-05-09 22:53 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp
::::::
:::::: Manual check reason: "low confidence static check warning: drivers/net/ethernet/mediatek/mtk_eth_soc.c:5559:18: sparse: sparse: unsigned value that used to be signed checked against zero?"
::::::
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Frank Wunderlich <frank-w@public-files.de>
tree: https://github.com/frank-w/BPI-R2-4.14 7.1-rc
head: 12aaea139e45ed0d826a63a866c1ce03d352fea6
commit: e8eac97b7338a6135e70129c65c63657d627ef71 [124/162] net: ethernet: mtk_eth_soc: support ethernet passive mux
:::::: branch date: 15 hours ago
:::::: commit date: 8 days ago
config: sparc-randconfig-r123-20260509 (https://download.01.org/0day-ci/archive/20260510/202605100604.Xsfc5vDV-lkp@intel.com/config)
compiler: sparc-linux-gcc (GCC) 8.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260510/202605100604.Xsfc5vDV-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202605100604.Xsfc5vDV-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
drivers/net/ethernet/mediatek/mtk_eth_soc.c:1973:45: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __sum16 [usertype] check @@ got restricted __be16 [usertype] @@
drivers/net/ethernet/mediatek/mtk_eth_soc.c:1973:45: sparse: expected restricted __sum16 [usertype] check
drivers/net/ethernet/mediatek/mtk_eth_soc.c:1973:45: sparse: got restricted __be16 [usertype]
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3211:22: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [usertype] val @@ got restricted __be32 [usertype] ip @@
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3211:22: sparse: expected unsigned int [usertype] val
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3211:22: sparse: got restricted __be32 [usertype] ip
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3317:18: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3317:16: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] ip4dst @@ got restricted __be32 [usertype] @@
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3317:16: sparse: expected unsigned int [usertype] ip4dst
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3317:16: sparse: got restricted __be32 [usertype]
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3322:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 @@ got unsigned int [usertype] ip4dst @@
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3322:38: sparse: expected restricted __be32
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3322:38: sparse: got unsigned int [usertype] ip4dst
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3343:16: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] ip4dst @@ got restricted __be32 @@
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3343:16: sparse: expected unsigned int [usertype] ip4dst
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3343:16: sparse: got restricted __be32
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3366:72: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [usertype] ip4dst @@ got restricted __be32 @@
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3366:72: sparse: expected unsigned int [usertype] ip4dst
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3366:72: sparse: got restricted __be32
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3384:72: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [usertype] ip4dst @@ got restricted __be32 @@
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3384:72: sparse: expected unsigned int [usertype] ip4dst
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3384:72: sparse: got restricted __be32
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3408:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 [usertype] ip4dst @@ got unsigned int [usertype] @@
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3408:38: sparse: expected restricted __be32 [usertype] ip4dst
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3408:38: sparse: got unsigned int [usertype]
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3412:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 [usertype] ip4src @@ got unsigned int @@
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3412:38: sparse: expected restricted __be32 [usertype] ip4src
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3412:38: sparse: got unsigned int
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3414:36: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] psrc @@ got int @@
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3414:36: sparse: expected restricted __be16 [usertype] psrc
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3414:36: sparse: got int
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3416:36: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] pdst @@ got int @@
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3416:36: sparse: expected restricted __be16 [usertype] pdst
drivers/net/ethernet/mediatek/mtk_eth_soc.c:3416:36: sparse: got int
drivers/net/ethernet/mediatek/mtk_eth_soc.c: note: in included file (through include/linux/if_ether.h, include/linux/ethtool.h, include/linux/phy.h, include/linux/of_mdio.h):
include/linux/skbuff.h:2903:28: sparse: sparse: unsigned value that used to be signed checked against zero?
include/linux/skbuff.h:2903:28: sparse: signed value source
>> drivers/net/ethernet/mediatek/mtk_eth_soc.c:5559:18: sparse: sparse: unsigned value that used to be signed checked against zero?
drivers/net/ethernet/mediatek/mtk_eth_soc.c: note: in included file (through include/linux/byteorder/big_endian.h, arch/sparc/include/uapi/asm/byteorder.h, arch/sparc/include/asm/bitops_32.h, ...):
include/uapi/linux/byteorder/big_endian.h:83:32: sparse: signed value source
vim +5559 drivers/net/ethernet/mediatek/mtk_eth_soc.c
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5544
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5545 static int mtk_add_mux(struct mtk_eth *eth, struct device_node *np)
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5546 {
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5547 const __be32 *_id = of_get_property(np, "reg", NULL);
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5548 struct device_node *child;
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5549 struct mtk_mux *mux;
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5550 unsigned int id;
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5551 int err;
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5552
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5553 if (!_id) {
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5554 dev_err(eth->dev, "missing attach mac id\n");
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5555 return -EINVAL;
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5556 }
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5557
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5558 id = be32_to_cpup(_id);
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 @5559 if (id < 0 || id >= MTK_MAX_DEVS) {
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5560 dev_err(eth->dev, "%d is not a valid attach mac id\n", id);
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5561 return -EINVAL;
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5562 }
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5563
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5564 mux = kmalloc(sizeof(struct mtk_mux), GFP_KERNEL);
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5565 if (unlikely(!mux)) {
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5566 dev_err(eth->dev, "failed to create mux structure\n");
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5567 return -ENOMEM;
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5568 }
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5569
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5570 eth->mux[id] = mux;
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5571 mux->mac = eth->mac[id];
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5572 mux->channel = 0;
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5573
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5574 mux->mod_def0_gpio = fwnode_gpiod_get_index(of_fwnode_handle(np),
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5575 "mod-def0", 0, GPIOD_IN |
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5576 GPIOD_FLAGS_BIT_NONEXCLUSIVE, "?");
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5577
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5578 if (IS_ERR(mux->mod_def0_gpio)) {
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5579 dev_err(eth->dev, "failed to requset gpio for mod-def0\n");
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5580 err = PTR_ERR(mux->mod_def0_gpio);
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5581 goto err_free_mux;
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5582 }
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5583
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5584 mux->chan_sel_gpio = fwnode_gpiod_get_index(of_fwnode_handle(np),
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5585 "chan-sel", 0, GPIOD_OUT_LOW, "?");
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5586
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5587 if (IS_ERR(mux->chan_sel_gpio)) {
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5588 dev_err(eth->dev, "failed to requset gpio for chan-sel\n");
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5589 err = PTR_ERR(mux->chan_sel_gpio);
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5590 goto err_put_mod_def0;
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5591 }
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5592
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5593 of_property_read_u32(np, "sfp-present-channel",
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5594 &mux->sfp_present_channel);
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5595
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5596 for_each_child_of_node(np, child) {
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5597 err = mtk_add_mux_channel(mux, child);
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5598 if (err) {
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5599 dev_err(eth->dev, "failed to add mtk_mux\n");
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5600 of_node_put(child);
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5601 goto err_put_chan_sel;
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5602 }
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5603 }
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5604
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5605 INIT_DELAYED_WORK(&mux->poll, mux_poll);
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5606 mod_delayed_work(system_wq, &mux->poll, msecs_to_jiffies(3000));
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5607
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5608 return 0;
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5609
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5610 err_put_chan_sel:
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5611 gpiod_put(mux->chan_sel_gpio);
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5612 err_put_mod_def0:
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5613 gpiod_put(mux->mod_def0_gpio);
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5614 err_free_mux:
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5615 kfree(mux);
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5616 eth->mux[id] = NULL;
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5617 return err;
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5618 }
e8eac97b7338a6 Bo-Cun Chen 2024-11-28 5619
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-05-09 22:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-09 22:53 [frank-w-bpi-r2-4.14:7.1-rc 124/162] drivers/net/ethernet/mediatek/mtk_eth_soc.c:5559:18: sparse: sparse: unsigned value that used to be signed checked against zero? kernel test robot
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.