staging: greybus: Constify gb_audio_module_type
authorAyush Tiwari <ayushtiw0110@gmail.com>
Mon, 18 Mar 2024 19:06:25 +0000 (00:36 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Mar 2024 17:25:45 +0000 (18:25 +0100)
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>
drivers/staging/greybus/audio_manager_module.c

index 5f9dcbdbc191870434fe4b0247f548cf46de5148..4a4dfb42f50f9a8a99aae71feb32f4a45991b9eb 100644 (file)
@@ -144,7 +144,7 @@ static struct attribute *gb_audio_module_default_attrs[] = {
 };
 ATTRIBUTE_GROUPS(gb_audio_module_default);
 
-static struct kobj_type gb_audio_module_type = {
+static const struct kobj_type gb_audio_module_type = {
        .sysfs_ops = &gb_audio_module_sysfs_ops,
        .release = gb_audio_module_release,
        .default_groups = gb_audio_module_default_groups,