Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: greybus: Constify gb_audio_module_type

Constify static struct kobj_type gb_audio_module_type to prevent
modification of data shared across many instances and to address the
checkpatch warning that "gb_audio_module_type" should be const. The
"gb_audio_module_type" struct is only used in one place:
err = kobject_init_and_add(&m->kobj, &gb_audio_module_type, NULL, ...
so checkpatch is correct that it can be made const.

Signed-off-by: Ayush Tiwari <ayushtiw0110@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/ZfiQsZBrHfImIJfc@ayush-HP-Pavilion-Gaming-Laptop-15-ec0xxx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ayush Tiwari and committed by
Greg Kroah-Hartman
6594d9c2 4cece764

+1 -1
+1 -1
drivers/staging/greybus/audio_manager_module.c
··· 144 144 }; 145 145 ATTRIBUTE_GROUPS(gb_audio_module_default); 146 146 147 - static struct kobj_type gb_audio_module_type = { 147 + static const struct kobj_type gb_audio_module_type = { 148 148 .sysfs_ops = &gb_audio_module_sysfs_ops, 149 149 .release = gb_audio_module_release, 150 150 .default_groups = gb_audio_module_default_groups,