]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
memstick: Constify the driver id_table
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Tue, 5 May 2026 10:39:28 +0000 (12:39 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 11 May 2026 14:59:43 +0000 (16:59 +0200)
Just like all other driver structures, the id_table should never be
modified by core subsystem parts.  Constify this member and actual data
structures for increased code safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/memstick/host/tifm_ms.c
drivers/misc/tifm_core.c
drivers/mmc/host/tifm_sd.c
include/linux/tifm.h

index 0b6a90661eee599990a3100552928914a9150d13..0a54586aa54e82307089c6585ac0c878c9cecdf2 100644 (file)
@@ -647,7 +647,7 @@ static int tifm_ms_resume(struct tifm_dev *sock)
 
 #endif /* CONFIG_PM */
 
-static struct tifm_device_id tifm_ms_id_tbl[] = {
+static const struct tifm_device_id tifm_ms_id_tbl[] = {
        { TIFM_TYPE_MS }, { 0 }
 };
 
index da0827724a61ce2a807ff321ea7134d607a51b73..aac8f0933e435abf0d34a8c5d2be7b9404008b31 100644 (file)
@@ -31,7 +31,7 @@ static const char *tifm_media_type_name(unsigned char type, unsigned char nt)
        return card_type_name[nt][type - 1];
 }
 
-static int tifm_dev_match(struct tifm_dev *sock, struct tifm_device_id *id)
+static int tifm_dev_match(struct tifm_dev *sock, const struct tifm_device_id *id)
 {
        if (sock->type == id->type)
                return 1;
@@ -43,7 +43,7 @@ static int tifm_bus_match(struct device *dev, const struct device_driver *drv)
        struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev);
        const struct tifm_driver *fm_drv = container_of_const(drv, struct tifm_driver,
                                                              driver);
-       struct tifm_device_id *ids = fm_drv->id_table;
+       const struct tifm_device_id *ids = fm_drv->id_table;
 
        if (ids) {
                while (ids->type) {
index aebffd3ebf60e73a6a03e4c9399367fe3c738d50..28ab2526dab15f1b6699aea56db221931b6c74bf 100644 (file)
@@ -1041,7 +1041,7 @@ static int tifm_sd_resume(struct tifm_dev *sock)
 
 #endif /* CONFIG_PM */
 
-static struct tifm_device_id tifm_sd_id_tbl[] = {
+static const struct tifm_device_id tifm_sd_id_tbl[] = {
        { TIFM_TYPE_SD }, { }
 };
 MODULE_DEVICE_TABLE(tifm, tifm_sd_id_tbl);
index 44073d06710f67f6bf9bf00344c116b34d4d6ac0..752fcfae27fe3951a9ffc0b579beb2aea91cb73f 100644 (file)
@@ -97,7 +97,7 @@ struct tifm_dev {
 };
 
 struct tifm_driver {
-       struct tifm_device_id *id_table;
+       const struct tifm_device_id *id_table;
        int                   (*probe)(struct tifm_dev *dev);
        void                  (*remove)(struct tifm_dev *dev);
        int                   (*suspend)(struct tifm_dev *dev,