]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Bluetooth: constify the struct device_type usage
authorRicardo B. Marliere <ricardo@marliere.net>
Mon, 19 Feb 2024 19:46:57 +0000 (16:46 -0300)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 6 Mar 2024 22:24:07 +0000 (17:24 -0500)
Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the bt_type and
bnep_type variables to be constant structures as well, placing it into
read-only memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
net/bluetooth/6lowpan.c
net/bluetooth/bnep/core.c

index 715cbafbf6631c275aa87f459812c7f3bdbc2923..27520a8a486f3c1e7649486ca1bd476ec20cf4e7 100644 (file)
@@ -572,7 +572,7 @@ static void netdev_setup(struct net_device *dev)
        dev->needs_free_netdev  = true;
 }
 
-static struct device_type bt_type = {
+static const struct device_type bt_type = {
        .name   = "bluetooth",
 };
 
index 5a6a49885ab66dedcddbeddaad85cb8d4671723c..8c3f8d0c03588bb28a37baa2ab4ea063d287c926 100644 (file)
@@ -549,7 +549,7 @@ static struct device *bnep_get_device(struct bnep_session *session)
        return &conn->hcon->dev;
 }
 
-static struct device_type bnep_type = {
+static const struct device_type bnep_type = {
        .name   = "bluetooth",
 };