[jpirko-mlxsw:jiri_devel_linecards 91/93] drivers/net/netdevsim/dev.c:119:57: error: passing argument 4 of 'devlink_linecard_device_create' from incompatible pointer type

From: kernel test robot
Date: Mon Apr 11 2022 - 20:41:21 EST


tree: https://github.com/jpirko/linux_mlxsw jiri_devel_linecards
head: e31049bc6a06f24c077e61e74b1bf1f137572726
commit: ac7fd66c0d376eb5bfe801b1a2226598705a6b6d [91/93] TMP: devlink device type
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20220412/202204120800.yyqLXueA-lkp@xxxxxxxxx/config)
compiler: powerpc-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/jpirko/linux_mlxsw/commit/ac7fd66c0d376eb5bfe801b1a2226598705a6b6d
git remote add jpirko-mlxsw https://github.com/jpirko/linux_mlxsw
git fetch --no-tags jpirko-mlxsw jiri_devel_linecards
git checkout ac7fd66c0d376eb5bfe801b1a2226598705a6b6d
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/net/netdevsim/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

drivers/net/netdevsim/dev.c: In function 'nsim_dev_linecard_devices_create':
>> drivers/net/netdevsim/dev.c:119:57: error: passing argument 4 of 'devlink_linecard_device_create' from incompatible pointer type [-Werror=incompatible-pointer-types]
119 | nsim_dev_linecard);
| ^~~~~~~~~~~~~~~~~
| |
| struct nsim_dev_linecard *
In file included from drivers/net/netdevsim/dev.c:29:
include/net/devlink.h:1610:44: note: expected 'const char *' but argument is of type 'struct nsim_dev_linecard *'
1610 | const char *type, void *priv);
| ~~~~~~~~~~~~^~~~
>> drivers/net/netdevsim/dev.c:117:26: error: too few arguments to function 'devlink_linecard_device_create'
117 | device = devlink_linecard_device_create(nsim_dev_linecard->devlink_linecard,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/netdevsim/dev.c:29:
include/net/devlink.h:1607:1: note: declared here
1607 | devlink_linecard_device_create(struct devlink_linecard *linecard,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/uapi/linux/posix_types.h:5,
from include/uapi/linux/types.h:14,
from include/linux/types.h:6,
from include/linux/kasan-checks.h:5,
from include/asm-generic/rwonce.h:26,
from ./arch/powerpc/include/generated/asm/rwonce.h:1,
from include/linux/compiler.h:248,
from include/linux/build_bug.h:5,
from include/linux/container_of.h:5,
from include/linux/list.h:5,
from include/linux/wait.h:7,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/debugfs.h:15,
from drivers/net/netdevsim/dev.c:18:
drivers/net/netdevsim/dev.c: In function 'nsim_esw_switchdev_enable':
include/linux/stddef.h:8:14: warning: passing argument 3 of '__nsim_dev_port_add' makes integer from pointer without a cast [-Wint-conversion]
8 | #define NULL ((void *)0)
| ^~~~~~~~~~~
| |
| void *
drivers/net/netdevsim/dev.c:870:43: note: in expansion of macro 'NULL'
870 | NULL, i);
| ^~~~
drivers/net/netdevsim/dev.c:845:34: note: expected 'unsigned int' but argument is of type 'void *'
845 | unsigned int port_index);
| ~~~~~~~~~~~~~^~~~~~~~~~
drivers/net/netdevsim/dev.c:869:23: error: too many arguments to function '__nsim_dev_port_add'
869 | err = __nsim_dev_port_add(nsim_dev, NSIM_DEV_PORT_TYPE_VF,
| ^~~~~~~~~~~~~~~~~~~
drivers/net/netdevsim/dev.c:844:1: note: declared here
844 | __nsim_dev_port_add(struct nsim_dev *nsim_dev, enum nsim_dev_port_type type,
| ^~~~~~~~~~~~~~~~~~~
drivers/net/netdevsim/dev.c:883:25: error: too many arguments to function '__nsim_dev_port_del'
883 | __nsim_dev_port_del(nsim_dev_port, NULL, i);
| ^~~~~~~~~~~~~~~~~~~
drivers/net/netdevsim/dev.c:846:13: note: declared here
846 | static void __nsim_dev_port_del(struct nsim_dev_port *nsim_dev_port);
| ^~~~~~~~~~~~~~~~~~~
drivers/net/netdevsim/dev.c: At top level:
drivers/net/netdevsim/dev.c:1625:12: error: conflicting types for '__nsim_dev_port_add'; have 'int(struct nsim_dev *, enum nsim_dev_port_type, struct nsim_dev_linecard *, unsigned int)'
1625 | static int __nsim_dev_port_add(struct nsim_dev *nsim_dev, enum nsim_dev_port_type type,
| ^~~~~~~~~~~~~~~~~~~
drivers/net/netdevsim/dev.c:844:1: note: previous declaration of '__nsim_dev_port_add' with type 'int(struct nsim_dev *, enum nsim_dev_port_type, unsigned int)'
844 | __nsim_dev_port_add(struct nsim_dev *nsim_dev, enum nsim_dev_port_type type,
| ^~~~~~~~~~~~~~~~~~~
drivers/net/netdevsim/dev.c:844:1: warning: '__nsim_dev_port_add' used but never defined
cc1: some warnings being treated as errors


vim +/devlink_linecard_device_create +119 drivers/net/netdevsim/dev.c

18c8e54cc09123 Jiri Pirko 2021-05-05 100
18c8e54cc09123 Jiri Pirko 2021-05-05 101 static int
18c8e54cc09123 Jiri Pirko 2021-05-05 102 nsim_dev_linecard_devices_create(struct nsim_dev_linecard *nsim_dev_linecard)
18c8e54cc09123 Jiri Pirko 2021-05-05 103 {
18c8e54cc09123 Jiri Pirko 2021-05-05 104 struct devlink_linecard_device *device;
18c8e54cc09123 Jiri Pirko 2021-05-05 105 char *component_name;
18c8e54cc09123 Jiri Pirko 2021-05-05 106 int err;
18c8e54cc09123 Jiri Pirko 2021-05-05 107 int i;
18c8e54cc09123 Jiri Pirko 2021-05-05 108
18c8e54cc09123 Jiri Pirko 2021-05-05 109 snprintf(nsim_dev_linecard->device_component_name,
18c8e54cc09123 Jiri Pirko 2021-05-05 110 sizeof(nsim_dev_linecard->device_component_name), "lc%u_dev0",
18c8e54cc09123 Jiri Pirko 2021-05-05 111 nsim_dev_linecard->linecard_index);
18c8e54cc09123 Jiri Pirko 2021-05-05 112 component_name = nsim_dev_linecard->device_component_name;
18c8e54cc09123 Jiri Pirko 2021-05-05 113
18c8e54cc09123 Jiri Pirko 2021-05-05 114 for (i = 0; i < NSIM_DEV_LINECARD_DEVICE_COUNT; i++) {
18c8e54cc09123 Jiri Pirko 2021-05-05 115 if (i > 0)
18c8e54cc09123 Jiri Pirko 2021-05-05 116 component_name = NULL;
18c8e54cc09123 Jiri Pirko 2021-05-05 @117 device = devlink_linecard_device_create(nsim_dev_linecard->devlink_linecard,
18c8e54cc09123 Jiri Pirko 2021-05-05 118 i, component_name,
18c8e54cc09123 Jiri Pirko 2021-05-05 @119 nsim_dev_linecard);
18c8e54cc09123 Jiri Pirko 2021-05-05 120 if (IS_ERR(device)) {
18c8e54cc09123 Jiri Pirko 2021-05-05 121 err = PTR_ERR(device);
18c8e54cc09123 Jiri Pirko 2021-05-05 122 goto rollback;
18c8e54cc09123 Jiri Pirko 2021-05-05 123 }
18c8e54cc09123 Jiri Pirko 2021-05-05 124 nsim_dev_linecard->devlink_device[i] = device;
18c8e54cc09123 Jiri Pirko 2021-05-05 125 }
18c8e54cc09123 Jiri Pirko 2021-05-05 126 return 0;
18c8e54cc09123 Jiri Pirko 2021-05-05 127
18c8e54cc09123 Jiri Pirko 2021-05-05 128 rollback:
18c8e54cc09123 Jiri Pirko 2021-05-05 129 for (i--; i >= 0; i--) {
18c8e54cc09123 Jiri Pirko 2021-05-05 130 device = nsim_dev_linecard->devlink_device[i];
18c8e54cc09123 Jiri Pirko 2021-05-05 131 devlink_linecard_device_destroy(nsim_dev_linecard->devlink_linecard,
18c8e54cc09123 Jiri Pirko 2021-05-05 132 device);
18c8e54cc09123 Jiri Pirko 2021-05-05 133 }
18c8e54cc09123 Jiri Pirko 2021-05-05 134 return err;
18c8e54cc09123 Jiri Pirko 2021-05-05 135 }
18c8e54cc09123 Jiri Pirko 2021-05-05 136

:::::: The code at line 119 was first introduced by commit
:::::: 18c8e54cc09123e6810b00d12879e2428dc9fbb9 netdevsim: create couple of devices on each linecard

:::::: TO: Jiri Pirko <jiri@xxxxxxxxxx>
:::::: CC: Jiri Pirko <jiri@xxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp