Fix warning for static const char * array in audio_manager_module.c
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 Fix warning for static const char * array in audio_manager_module.c
Quoted 8 lines · Greg Kroah-Hartman
Quoted 7 lines · Emmanouil Perselis
This patch fixes the warning "static const char * array should probably be static const char * const" in
drivers/staging/greybus/audio_manager_module.cI think Greg's patch bot is telling you that you need to carbon-copy the mailing list on your patch submission, not just address it to the maintainers.
Added addresses to carbon copy.
Quoted 55 lines
Quoted 24 lines
-Alex
Signed-off-by Emmanouil Perselis <[email protected]>--- drivers/staging/greybus/audio_manager_module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/greybus/audio_manager_module.c +1
-1@@ -158,7 +158,7 @@ static void send_add_uevent(struct gb_audio_manager_module *module)char ip_devices_string[64 ];char op_devices_string[64 ]; -char *envp[] = { +static const char *const envp[] = { name_string, vid_string, pid_string,Signature · 1 line
2.20.1Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.
You are receiving this message because of the following common error(s) as indicated below:
- Your patch was sent privately to Greg. Kernel development is done in public, please always cc: a public mailing list with a patch submission. Using the tool,
scripts/get_maintainer.plon the patch will tell you what mailing list to cc.- You did not specify a description of why the patch is needed, or possibly, any description at all, in the email body. Please read the section entitled "The canonical patch format" in the kernel file,
Documentation/SubmittingPatchesfor what is needed in order to properly describe the change.- You did not write a descriptive Subject: for the patch, allowing Greg, and everyone else, to know what this patch is all about. Please read the section entitled "The canonical patch format" in the kernel file,
Documentation/SubmittingPatchesfor what a proper Subject: line should look like.
Quoted 9 lines
If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.
thanks,
greg k-h's patch email bot
--- drivers/staging/greybus/audio_manager_module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/greybus/audio_manager_module.c +1 -1
@@ -158,7 +158,7 @@ static void send_add_uevent(struct gb_audio_manager_module *module)char ip_devices_string[64 ];char op_devices_string[64 ]; -char *envp[] = { +static const char *const envp[] = { name_string, vid_string, pid_string,
Signature · 1 line
2.20.1
kernel test robot
build botThank you for the patch! Yet something to improve:
Hi Emmanouil,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v5.10-rc4 next-20201116]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Emmanouil-Perselis/Fix-warning-for-static-const-char-array-in-audio_manager_module-c/20201117-044852 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 0d79a48440f559ac939d1be2089757c5e4ab16c7 config: microblaze-randconfig-r011-20201116 (attached as .config) compiler: microblaze-linux-gcc (GCC) 9.3.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/0day-ci/linux/commit/69022592162daaee87b29588cd562da4439f0517
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Emmanouil-Perselis/Fix-warning-for-static-const-char-array-in-audio_manager_module-c/20201117-044852 git checkout 69022592162daaee87b29588cd562da4439f0517
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=microblaze
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/staging/greybus/audio_manager_module.c: In function 'send_add_uevent':
>> drivers/staging/greybus/audio_manager_module.c:162:3: error: initializer element is not constant
162 | name_string,
| ^~~~~~~~~~~
drivers/staging/greybus/audio_manager_module.c:162:3: note: (near initialization for 'envp[0]')
drivers/staging/greybus/audio_manager_module.c:163:3: error: initializer element is not constant
163 | vid_string,
| ^~~~~~~~~~
drivers/staging/greybus/audio_manager_module.c:163:3: note: (near initialization for 'envp[1]')
drivers/staging/greybus/audio_manager_module.c:164:3: error: initializer element is not constant
164 | pid_string,
| ^~~~~~~~~~
drivers/staging/greybus/audio_manager_module.c:164:3: note: (near initialization for 'envp[2]')
drivers/staging/greybus/audio_manager_module.c:165:3: error: initializer element is not constant
165 | intf_id_string,
| ^~~~~~~~~~~~~~
drivers/staging/greybus/audio_manager_module.c:165:3: note: (near initialization for 'envp[3]')
drivers/staging/greybus/audio_manager_module.c:166:3: error: initializer element is not constant
166 | ip_devices_string,
| ^~~~~~~~~~~~~~~~~
drivers/staging/greybus/audio_manager_module.c:166:3: note: (near initialization for 'envp[4]')
drivers/staging/greybus/audio_manager_module.c:167:3: error: initializer element is not constant
167 | op_devices_string,
| ^~~~~~~~~~~~~~~~~
drivers/staging/greybus/audio_manager_module.c:167:3: note: (near initialization for 'envp[5]')
>> drivers/staging/greybus/audio_manager_module.c:180:46: error: passing argument 3 of 'kobject_uevent_env' from incompatible pointer type [-Werror=incompatible-pointer-types]
180 | kobject_uevent_env(&module->kobj, KOBJ_ADD, envp);
| ^~~~
| |
| const char * const*
In file included from drivers/staging/greybus/audio_manager.h:11,
from drivers/staging/greybus/audio_manager_module.c:10:
include/linux/kobject.h:241:10: note: expected 'char **' but argument is of type 'const char * const*'
241 | char *envp[]);
| ~~~~~~^~~~~~cc1: some warnings being treated as errors
vim +162 drivers/staging/greybus/audio_manager_module.c
8db00736d365b75 Svetlin Ankov 2016-01-13 151
8db00736d365b75 Svetlin Ankov 2016-01-13 152 static void send_add_uevent(struct gb_audio_manager_module *module)
8db00736d365b75 Svetlin Ankov 2016-01-13 153 {
8db00736d365b75 Svetlin Ankov 2016-01-13 154 char name_string[128];
8db00736d365b75 Svetlin Ankov 2016-01-13 155 char vid_string[64];
8db00736d365b75 Svetlin Ankov 2016-01-13 156 char pid_string[64];
d0af1bd5f6f4497 Pankaj Bharadiya 2016-10-16 157 char intf_id_string[64];
a9234bfd6cec442 Vaibhav Agarwal 2016-03-30 158 char ip_devices_string[64];
a9234bfd6cec442 Vaibhav Agarwal 2016-03-30 159 char op_devices_string[64];
8db00736d365b75 Svetlin Ankov 2016-01-13 160
69022592162daae Emmanouil Perselis 2020-11-16 161 static const char * const envp[] = {
8db00736d365b75 Svetlin Ankov 2016-01-13 @162 name_string,
8db00736d365b75 Svetlin Ankov 2016-01-13 163 vid_string,
8db00736d365b75 Svetlin Ankov 2016-01-13 164 pid_string,
d0af1bd5f6f4497 Pankaj Bharadiya 2016-10-16 @165 intf_id_string,
a9234bfd6cec442 Vaibhav Agarwal 2016-03-30 166 ip_devices_string,
a9234bfd6cec442 Vaibhav Agarwal 2016-03-30 167 op_devices_string,
8db00736d365b75 Svetlin Ankov 2016-01-13 168 NULL
8db00736d365b75 Svetlin Ankov 2016-01-13 169 };
8db00736d365b75 Svetlin Ankov 2016-01-13 170
8db00736d365b75 Svetlin Ankov 2016-01-13 171 snprintf(name_string, 128, "NAME=%s", module->desc.name);
8db00736d365b75 Svetlin Ankov 2016-01-13 172 snprintf(vid_string, 64, "VID=%d", module->desc.vid);
8db00736d365b75 Svetlin Ankov 2016-01-13 173 snprintf(pid_string, 64, "PID=%d", module->desc.pid);
d0af1bd5f6f4497 Pankaj Bharadiya 2016-10-16 174 snprintf(intf_id_string, 64, "INTF_ID=%d", module->desc.intf_id);
a9234bfd6cec442 Vaibhav Agarwal 2016-03-30 175 snprintf(ip_devices_string, 64, "I/P DEVICES=0x%X",
a9234bfd6cec442 Vaibhav Agarwal 2016-03-30 176 module->desc.ip_devices);
a9234bfd6cec442 Vaibhav Agarwal 2016-03-30 177 snprintf(op_devices_string, 64, "O/P DEVICES=0x%X",
a9234bfd6cec442 Vaibhav Agarwal 2016-03-30 178 module->desc.op_devices);
8db00736d365b75 Svetlin Ankov 2016-01-13 179
8db00736d365b75 Svetlin Ankov 2016-01-13 @180 kobject_uevent_env(&module->kobj, KOBJ_ADD, envp);
8db00736d365b75 Svetlin Ankov 2016-01-13 181 }
8db00736d365b75 Svetlin Ankov 2016-01-13 182 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botThank you for the patch! Yet something to improve:
Hi Emmanouil,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v5.10-rc4 next-20201116]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Emmanouil-Perselis/Fix-warning-for-static-const-char-array-in-audio_manager_module-c/20201117-044852 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 0d79a48440f559ac939d1be2089757c5e4ab16c7 config: x86_64-randconfig-a006-20201115 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ace9653c11c6308401dcda2e8b26bf97e6e66e30)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/69022592162daaee87b29588cd562da4439f0517
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Emmanouil-Perselis/Fix-warning-for-static-const-char-array-in-audio_manager_module-c/20201117-044852 git checkout 69022592162daaee87b29588cd562da4439f0517
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
>> drivers/staging/greybus/audio_manager_module.c:162:3: error: initializer element is not a compile-time constant
name_string,
^~~~~~~~~~~
>> drivers/staging/greybus/audio_manager_module.c:180:46: error: passing 'const char *const [7]' to parameter of type 'char **' discards qualifiers in nested pointer types [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
kobject_uevent_env(&module->kobj, KOBJ_ADD, envp);
^~~~
include/linux/kobject.h:241:10: note: passing argument to parameter 'envp' here
char *envp[]);
^2 errors generated.
vim +162 drivers/staging/greybus/audio_manager_module.c
8db00736d365b7 Svetlin Ankov 2016-01-13 151
8db00736d365b7 Svetlin Ankov 2016-01-13 152 static void send_add_uevent(struct gb_audio_manager_module *module)
8db00736d365b7 Svetlin Ankov 2016-01-13 153 {
8db00736d365b7 Svetlin Ankov 2016-01-13 154 char name_string[128];
8db00736d365b7 Svetlin Ankov 2016-01-13 155 char vid_string[64];
8db00736d365b7 Svetlin Ankov 2016-01-13 156 char pid_string[64];
d0af1bd5f6f449 Pankaj Bharadiya 2016-10-16 157 char intf_id_string[64];
a9234bfd6cec44 Vaibhav Agarwal 2016-03-30 158 char ip_devices_string[64];
a9234bfd6cec44 Vaibhav Agarwal 2016-03-30 159 char op_devices_string[64];
8db00736d365b7 Svetlin Ankov 2016-01-13 160
69022592162daa Emmanouil Perselis 2020-11-16 161 static const char * const envp[] = {
8db00736d365b7 Svetlin Ankov 2016-01-13 @162 name_string,
8db00736d365b7 Svetlin Ankov 2016-01-13 163 vid_string,
8db00736d365b7 Svetlin Ankov 2016-01-13 164 pid_string,
d0af1bd5f6f449 Pankaj Bharadiya 2016-10-16 165 intf_id_string,
a9234bfd6cec44 Vaibhav Agarwal 2016-03-30 166 ip_devices_string,
a9234bfd6cec44 Vaibhav Agarwal 2016-03-30 167 op_devices_string,
8db00736d365b7 Svetlin Ankov 2016-01-13 168 NULL
8db00736d365b7 Svetlin Ankov 2016-01-13 169 };
8db00736d365b7 Svetlin Ankov 2016-01-13 170
8db00736d365b7 Svetlin Ankov 2016-01-13 171 snprintf(name_string, 128, "NAME=%s", module->desc.name);
8db00736d365b7 Svetlin Ankov 2016-01-13 172 snprintf(vid_string, 64, "VID=%d", module->desc.vid);
8db00736d365b7 Svetlin Ankov 2016-01-13 173 snprintf(pid_string, 64, "PID=%d", module->desc.pid);
d0af1bd5f6f449 Pankaj Bharadiya 2016-10-16 174 snprintf(intf_id_string, 64, "INTF_ID=%d", module->desc.intf_id);
a9234bfd6cec44 Vaibhav Agarwal 2016-03-30 175 snprintf(ip_devices_string, 64, "I/P DEVICES=0x%X",
a9234bfd6cec44 Vaibhav Agarwal 2016-03-30 176 module->desc.ip_devices);
a9234bfd6cec44 Vaibhav Agarwal 2016-03-30 177 snprintf(op_devices_string, 64, "O/P DEVICES=0x%X",
a9234bfd6cec44 Vaibhav Agarwal 2016-03-30 178 module->desc.op_devices);
8db00736d365b7 Svetlin Ankov 2016-01-13 179
8db00736d365b7 Svetlin Ankov 2016-01-13 @180 kobject_uevent_env(&module->kobj, KOBJ_ADD, envp);
8db00736d365b7 Svetlin Ankov 2016-01-13 181 }
8db00736d365b7 Svetlin Ankov 2016-01-13 182 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Greg KH
maintainerQuoted 11 lines · Emmanouil Perselis
Quoted 8 lines · Greg Kroah-Hartman
Quoted 7 lines · Emmanouil Perselis
This patch fixes the warning "static const char * array should probably be static const char * const" in
drivers/staging/greybus/audio_manager_module.cI think Greg's patch bot is telling you that you need to carbon-copy the mailing list on your patch submission, not just address it to the maintainers.
Added addresses to carbon copy.
Do you think this is the correct way to submit a patch that doesn't have to be hand-edited in order to apply it?
Please make it match other submitted patches, but most importantly, actually test-build your changes to ensure that they are correct.
thanks,
greg k-h