drivers/bus/ti-sysc.c:3107:19: warning: cast to smaller integer type 'enum sysc_soc' from 'const void *'
kernel test robot
build botHi Tony,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git omap-for-v6.6/ti-sysc head: 40a4f49cd32dbc641c706215c1fa6c5bd051428c commit: 063dc0622705623b3a70739b9f33d5ea019882e6 [3/5] bus: ti-sysc: Build driver for TI K3 SoCs config: arm64-randconfig-r006-20230815 (https://download.01.org/0day-ci/archive/20230815/[email protected]/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a) reproduce: (https://download.01.org/0day-ci/archive/20230815/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/bus/ti-sysc.c:3107:19: warning: cast to smaller integer type 'enum sysc_soc' from 'const void *' [-Wvoid-pointer-to-enum-cast]
3107 | sysc_soc->soc = (enum sysc_soc)match->data;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~1 warning generated.
vim +3107 drivers/bus/ti-sysc.c
feaa8baee82aba Tony Lindgren 2020-02-24 3073
feaa8baee82aba Tony Lindgren 2020-02-24 3074 /*
9d881361206ebc Tony Lindgren 2021-09-21 3075 * One time init to detect the booted SoC, disable unavailable features
9d881361206ebc Tony Lindgren 2021-09-21 3076 * and initialize list for optional cpu_pm notifier.
9d881361206ebc Tony Lindgren 2021-09-21 3077 *
feaa8baee82aba Tony Lindgren 2020-02-24 3078 * Note that we initialize static data shared across all ti-sysc instances
feaa8baee82aba Tony Lindgren 2020-02-24 3079 * so ddata is only used for SoC type. This can be called from module_init
feaa8baee82aba Tony Lindgren 2020-02-24 3080 * once we no longer need to rely on platform data.
feaa8baee82aba Tony Lindgren 2020-02-24 3081 */
9d881361206ebc Tony Lindgren 2021-09-21 3082 static int sysc_init_static_data(struct sysc *ddata)
feaa8baee82aba Tony Lindgren 2020-02-24 3083 {
feaa8baee82aba Tony Lindgren 2020-02-24 3084 const struct soc_device_attribute *match;
feaa8baee82aba Tony Lindgren 2020-02-24 3085 struct ti_sysc_platform_data *pdata;
feaa8baee82aba Tony Lindgren 2020-02-24 3086 unsigned long features = 0;
5f7259a578e9c6 Tony Lindgren 2021-03-08 3087 struct device_node *np;
feaa8baee82aba Tony Lindgren 2020-02-24 3088
feaa8baee82aba Tony Lindgren 2020-02-24 3089 if (sysc_soc)
feaa8baee82aba Tony Lindgren 2020-02-24 3090 return 0;
feaa8baee82aba Tony Lindgren 2020-02-24 3091
feaa8baee82aba Tony Lindgren 2020-02-24 3092 sysc_soc = kzalloc(sizeof(*sysc_soc), GFP_KERNEL);
feaa8baee82aba Tony Lindgren 2020-02-24 3093 if (!sysc_soc)
feaa8baee82aba Tony Lindgren 2020-02-24 3094 return -ENOMEM;
feaa8baee82aba Tony Lindgren 2020-02-24 3095
feaa8baee82aba Tony Lindgren 2020-02-24 3096 mutex_init(&sysc_soc->list_lock);
feaa8baee82aba Tony Lindgren 2020-02-24 3097 INIT_LIST_HEAD(&sysc_soc->disabled_modules);
9d881361206ebc Tony Lindgren 2021-09-21 3098 INIT_LIST_HEAD(&sysc_soc->restored_modules);
feaa8baee82aba Tony Lindgren 2020-02-24 3099 sysc_soc->general_purpose = true;
feaa8baee82aba Tony Lindgren 2020-02-24 3100
feaa8baee82aba Tony Lindgren 2020-02-24 3101 pdata = dev_get_platdata(ddata->dev);
feaa8baee82aba Tony Lindgren 2020-02-24 3102 if (pdata && pdata->soc_type_gp)
feaa8baee82aba Tony Lindgren 2020-02-24 3103 sysc_soc->general_purpose = pdata->soc_type_gp();
feaa8baee82aba Tony Lindgren 2020-02-24 3104
feaa8baee82aba Tony Lindgren 2020-02-24 3105 match = soc_device_match(sysc_soc_match);
feaa8baee82aba Tony Lindgren 2020-02-24 3106 if (match && match->data)
e1e1e9bb9d943e Tony Lindgren 2023-08-04 @3107 sysc_soc->soc = (enum sysc_soc)match->data;
feaa8baee82aba Tony Lindgren 2020-02-24 3108
5f7259a578e9c6 Tony Lindgren 2021-03-08 3109 /*
5f7259a578e9c6 Tony Lindgren 2021-03-08 3110 * Check and warn about possible old incomplete dtb. We now want to see
5f7259a578e9c6 Tony Lindgren 2021-03-08 3111 * simple-pm-bus instead of simple-bus in the dtb for genpd using SoCs.
5f7259a578e9c6 Tony Lindgren 2021-03-08 3112 */
5f7259a578e9c6 Tony Lindgren 2021-03-08 3113 switch (sysc_soc->soc) {
5f7259a578e9c6 Tony Lindgren 2021-03-08 3114 case SOC_AM3:
5f7259a578e9c6 Tony Lindgren 2021-03-08 3115 case SOC_AM4:
4adcf4c28f6dc1 Tony Lindgren 2021-03-12 3116 case SOC_4430 ... SOC_4470:
4adcf4c28f6dc1 Tony Lindgren 2021-03-12 3117 case SOC_5430:
4adcf4c28f6dc1 Tony Lindgren 2021-03-12 3118 case SOC_DRA7:
5f7259a578e9c6 Tony Lindgren 2021-03-08 3119 np = of_find_node_by_path("/ocp");
5f7259a578e9c6 Tony Lindgren 2021-03-08 3120 WARN_ONCE(np && of_device_is_compatible(np, "simple-bus"),
5f7259a578e9c6 Tony Lindgren 2021-03-08 3121 "ti-sysc: Incomplete old dtb, please update\n");
5f7259a578e9c6 Tony Lindgren 2021-03-08 3122 break;
5f7259a578e9c6 Tony Lindgren 2021-03-08 3123 default:
5f7259a578e9c6 Tony Lindgren 2021-03-08 3124 break;
5f7259a578e9c6 Tony Lindgren 2021-03-08 3125 }
5f7259a578e9c6 Tony Lindgren 2021-03-08 3126
4bba9bf08ff41d Tony Lindgren 2020-05-07 3127 /* Ignore devices that are not available on HS and EMU SoCs */
4bba9bf08ff41d Tony Lindgren 2020-05-07 3128 if (!sysc_soc->general_purpose) {
4bba9bf08ff41d Tony Lindgren 2020-05-07 3129 switch (sysc_soc->soc) {
4bba9bf08ff41d Tony Lindgren 2020-05-07 3130 case SOC_3430 ... SOC_3630:
4bba9bf08ff41d Tony Lindgren 2020-05-07 3131 sysc_add_disabled(0x48304000); /* timer12 */
4bba9bf08ff41d Tony Lindgren 2020-05-07 3132 break;
a6d90e9f22328f Kevin Hilman 2021-07-20 3133 case SOC_AM3:
a6d90e9f22328f Kevin Hilman 2021-07-20 3134 sysc_add_disabled(0x48310000); /* rng */
e879f855e590b4 Nathan Chancellor 2021-08-15 3135 break;
4bba9bf08ff41d Tony Lindgren 2020-05-07 3136 default:
4bba9bf08ff41d Tony Lindgren 2020-05-07 3137 break;
52fbb5aabb5cf6 Yang Li 2021-02-02 3138 }
4bba9bf08ff41d Tony Lindgren 2020-05-07 3139 }
4bba9bf08ff41d Tony Lindgren 2020-05-07 3140
feaa8baee82aba Tony Lindgren 2020-02-24 3141 match = soc_device_match(sysc_soc_feat_match);
feaa8baee82aba Tony Lindgren 2020-02-24 3142 if (!match)
feaa8baee82aba Tony Lindgren 2020-02-24 3143 return 0;
feaa8baee82aba Tony Lindgren 2020-02-24 3144
feaa8baee82aba Tony Lindgren 2020-02-24 3145 if (match->data)
feaa8baee82aba Tony Lindgren 2020-02-24 3146 features = (unsigned long)match->data;
feaa8baee82aba Tony Lindgren 2020-02-24 3147
feaa8baee82aba Tony Lindgren 2020-02-24 3148 /*
feaa8baee82aba Tony Lindgren 2020-02-24 3149 * Add disabled devices to the list based on the module base.
feaa8baee82aba Tony Lindgren 2020-02-24 3150 * Note that this must be done before we attempt to access the
feaa8baee82aba Tony Lindgren 2020-02-24 3151 * device and have module revision checks working.
feaa8baee82aba Tony Lindgren 2020-02-24 3152 */
feaa8baee82aba Tony Lindgren 2020-02-24 3153 if (features & DIS_ISP)
feaa8baee82aba Tony Lindgren 2020-02-24 3154 sysc_add_disabled(0x480bd400);
feaa8baee82aba Tony Lindgren 2020-02-24 3155 if (features & DIS_IVA)
feaa8baee82aba Tony Lindgren 2020-02-24 3156 sysc_add_disabled(0x5d000000);
feaa8baee82aba Tony Lindgren 2020-02-24 3157 if (features & DIS_SGX)
feaa8baee82aba Tony Lindgren 2020-02-24 3158 sysc_add_disabled(0x50000000);
feaa8baee82aba Tony Lindgren 2020-02-24 3159
feaa8baee82aba Tony Lindgren 2020-02-24 3160 return 0;
feaa8baee82aba Tony Lindgren 2020-02-24 3161 }
feaa8baee82aba Tony Lindgren 2020-02-24 3162 :::::: The code at line 3107 was first introduced by commit
:::::: e1e1e9bb9d943ec690670a609a5f660ca10eaf85 bus: ti-sysc: Fix build warning for 64-bit build
:::::: TO: Tony Lindgren <[email protected]>
:::::: CC: Tony Lindgren <[email protected]>
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 16 lines · kernel test robot
Hi Tony,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git omap-for-v6.6/ti-sysc head: 40a4f49cd32dbc641c706215c1fa6c5bd051428c commit: 063dc0622705623b3a70739b9f33d5ea019882e6 [3/5] bus: ti-sysc: Build driver for TI K3 SoCs config: arm64-randconfig-r006-20230815 (https://download.01.org/0day-ci/archive/20230815/[email protected]/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a) reproduce: (https://download.01.org/0day-ci/archive/20230815/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Quoted 6 lines
All warnings (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
drivers/bus/ti-sysc.c:3107:19: warning: cast to smaller integer type 'enumsysc_soc' from 'const void *' [-Wvoid-pointer-to-enum-cast]3107 | sysc_soc->soc = (enum sysc_soc)match->data; | ^~~~~~~~~~~~~~~~~~~~~~~~~~1 warning generated.
Thanks seems we need to do (enum sysc_soc)(unsigned long)match->data or just (unsigned long)match->data.
Regards,
Tony
Quoted 19 lines · Tony Lindgren
Quoted 18 lines · kernel test robot
Hi Tony,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git omap-for-v6.6/ti-sysc head: 40a4f49cd32dbc641c706215c1fa6c5bd051428c commit: 063dc0622705623b3a70739b9f33d5ea019882e6 [3/5] bus: ti-sysc: Build driver for TI K3 SoCs config: arm64-randconfig-r006-20230815 (https://download.01.org/0day-ci/archive/20230815/[email protected]/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a) reproduce: (https://download.01.org/0day-ci/archive/20230815/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All warnings (new ones prefixed by >>):
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
drivers/bus/ti-sysc.c:3107:19: warning: cast to smaller integer type 'enumsysc_soc' from 'const void *' [-Wvoid-pointer-to-enum-cast]3107 | sysc_soc->soc = (enum sysc_soc)match->data; | ^~~~~~~~~~~~~~~~~~~~~~~~~~1 warning generated.
Thanks seems we need to do (enum sysc_soc)(unsigned long)match->data or just (unsigned long)match->data.
Actually seems (enum sysc_soc)(uintptr_t)match->data is what is used in similar places based on git grep " = (enum " | grep ')('.
Regards,
Tony