Re: [PATCH v5 3/4] clk: sophgo: Add SG2042 clock generator driver

From: kernel test robot
Date: Thu Dec 07 2023 - 15:34:19 EST


Hi Chen,

kernel test robot noticed the following build warnings:

[auto build test WARNING on b85ea95d086471afb4ad062012a4d73cd328fa86]

url: https://github.com/intel-lab-lkp/linux/commits/Chen-Wang/dt-bindings-soc-sophgo-Add-Sophgo-system-control-module/20231207-165948
base: b85ea95d086471afb4ad062012a4d73cd328fa86
patch link: https://lore.kernel.org/r/975f9995584dfa8af751e96a1f4d2c7991551a35.1701938395.git.unicorn_wang%40outlook.com
patch subject: [PATCH v5 3/4] clk: sophgo: Add SG2042 clock generator driver
config: arm-randconfig-003-20231208 (https://download.01.org/0day-ci/archive/20231208/202312080419.Yfn8RQbT-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231208/202312080419.Yfn8RQbT-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312080419.Yfn8RQbT-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/clk/sophgo/clk-sophgo-sg2042.c:1273:13: error: implicit declaration of function 'kzalloc' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
clk_data = kzalloc(struct_size(clk_data, onecell_data.hws, num_clks), GFP_KERNEL);
^
drivers/clk/sophgo/clk-sophgo-sg2042.c:1273:13: note: did you mean 'vzalloc'?
include/linux/vmalloc.h:141:14: note: 'vzalloc' declared here
extern void *vzalloc(unsigned long size) __alloc_size(1);
^
>> drivers/clk/sophgo/clk-sophgo-sg2042.c:1273:11: warning: incompatible integer to pointer conversion assigning to 'struct sg2042_clk_data *' from 'int' [-Wint-conversion]
clk_data = kzalloc(struct_size(clk_data, onecell_data.hws, num_clks), GFP_KERNEL);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/clk/sophgo/clk-sophgo-sg2042.c:1293:2: error: implicit declaration of function 'kfree' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
kfree(clk_data);
^
drivers/clk/sophgo/clk-sophgo-sg2042.c:1349:2: error: implicit declaration of function 'kfree' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
kfree(clk_data);
^
1 warning and 3 errors generated.


vim +1273 drivers/clk/sophgo/clk-sophgo-sg2042.c

1256
1257 static int __init sg2042_clk_init_clk_data(
1258 struct device_node *node,
1259 int num_clks,
1260 struct sg2042_clk_data **pp_clk_data)
1261 {
1262 int ret = 0;
1263 struct sg2042_clk_data *clk_data = NULL;
1264 struct device_node *np_syscon;
1265
1266 np_syscon = of_parse_phandle(node, "sophgo,system-ctrl", 0);
1267 if (!np_syscon) {
1268 pr_err("failed to get system-ctrl node\n");
1269 ret = -EINVAL;
1270 goto error_out;
1271 }
1272
> 1273 clk_data = kzalloc(struct_size(clk_data, onecell_data.hws, num_clks), GFP_KERNEL);
1274 if (!clk_data) {
1275 ret = -ENOMEM;
1276 goto error_out;
1277 }
1278
1279 clk_data->regmap_syscon = device_node_to_regmap(np_syscon);
1280 if (IS_ERR_OR_NULL(clk_data->regmap_syscon)) {
1281 pr_err("cannot get regmap_syscon %ld\n", PTR_ERR(clk_data->regmap_syscon));
1282 ret = -ENODEV;
1283 goto cleanup;
1284 }
1285 clk_data->iobase_syscon = of_iomap(np_syscon, 0);
1286 clk_data->iobase = of_iomap(node, 0);
1287 clk_data->onecell_data.num = num_clks;
1288
1289 *pp_clk_data = clk_data;
1290 return ret;
1291
1292 cleanup:
1293 kfree(clk_data);
1294
1295 error_out:
1296 return ret;
1297 }
1298

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki