Re: [PATCH net-next v5 1/9] net: marvell: prestera: Add router nexthops ABI
From: Dan Carpenter
Date: Tue Sep 13 2022 - 05:14:45 EST
Hi Yevhen,
url: https://github.com/intel-lab-lkp/linux/commits/Yevhen-Orlov/net-marvell-prestera-add-nexthop-routes-offloading/20220909-065815
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 9f8f1933dce555d3c246f447f54fca8de8889da9
config: openrisc-randconfig-m041-20220907 (https://download.01.org/0day-ci/archive/20220911/202209111152.gf5xyKKy-lkp@xxxxxxxxx/config)
compiler: or1k-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
smatch warnings:
drivers/net/ethernet/marvell/prestera/prestera_hw.c:2139 prestera_hw_nhgrp_blk_get() error: uninitialized symbol 'err'.
vim +/err +2139 drivers/net/ethernet/marvell/prestera/prestera_hw.c
ec3daf86e28107 Yevhen Orlov 2022-09-09 2110 int prestera_hw_nhgrp_blk_get(struct prestera_switch *sw,
ec3daf86e28107 Yevhen Orlov 2022-09-09 2111 u8 *hw_state, u32 buf_size /* Buffer in bytes */)
ec3daf86e28107 Yevhen Orlov 2022-09-09 2112 {
ec3daf86e28107 Yevhen Orlov 2022-09-09 2113 struct prestera_msg_nh_chunk_req req;
ec3daf86e28107 Yevhen Orlov 2022-09-09 2114 static struct prestera_msg_nh_chunk_resp resp;
ec3daf86e28107 Yevhen Orlov 2022-09-09 2115 int err;
ec3daf86e28107 Yevhen Orlov 2022-09-09 2116 u32 buf_offset;
ec3daf86e28107 Yevhen Orlov 2022-09-09 2117
ec3daf86e28107 Yevhen Orlov 2022-09-09 2118 memset(&hw_state[0], 0, buf_size);
ec3daf86e28107 Yevhen Orlov 2022-09-09 2119 buf_offset = 0;
ec3daf86e28107 Yevhen Orlov 2022-09-09 2120 while (1) {
ec3daf86e28107 Yevhen Orlov 2022-09-09 2121 if (buf_offset >= buf_size)
ec3daf86e28107 Yevhen Orlov 2022-09-09 2122 break;
Smatch always worries about zero sizes...
ec3daf86e28107 Yevhen Orlov 2022-09-09 2123
ec3daf86e28107 Yevhen Orlov 2022-09-09 2124 memset(&req, 0, sizeof(req));
ec3daf86e28107 Yevhen Orlov 2022-09-09 2125 req.offset = __cpu_to_le32(buf_offset * 8); /* 8 bits in u8 */
ec3daf86e28107 Yevhen Orlov 2022-09-09 2126 err = prestera_cmd_ret(sw,
ec3daf86e28107 Yevhen Orlov 2022-09-09 2127 PRESTERA_CMD_TYPE_ROUTER_NH_GRP_BLK_GET,
ec3daf86e28107 Yevhen Orlov 2022-09-09 2128 &req.cmd, sizeof(req), &resp.ret,
ec3daf86e28107 Yevhen Orlov 2022-09-09 2129 sizeof(resp));
ec3daf86e28107 Yevhen Orlov 2022-09-09 2130 if (err)
ec3daf86e28107 Yevhen Orlov 2022-09-09 2131 return err;
ec3daf86e28107 Yevhen Orlov 2022-09-09 2132
ec3daf86e28107 Yevhen Orlov 2022-09-09 2133 memcpy(&hw_state[buf_offset], &resp.hw_state[0],
ec3daf86e28107 Yevhen Orlov 2022-09-09 2134 buf_offset + PRESTERA_MSG_CHUNK_SIZE > buf_size ?
ec3daf86e28107 Yevhen Orlov 2022-09-09 2135 buf_size - buf_offset : PRESTERA_MSG_CHUNK_SIZE);
ec3daf86e28107 Yevhen Orlov 2022-09-09 2136 buf_offset += PRESTERA_MSG_CHUNK_SIZE;
ec3daf86e28107 Yevhen Orlov 2022-09-09 2137 }
ec3daf86e28107 Yevhen Orlov 2022-09-09 2138
ec3daf86e28107 Yevhen Orlov 2022-09-09 @2139 return err;
ec3daf86e28107 Yevhen Orlov 2022-09-09 2140 }
--
0-DAY CI Kernel Test Service
https://01.org/lkp