]> git.neil.brown.name Git - history.git/commitdiff
[Bluetooth] Fix kobject oops on firmware loading
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 4 Jul 2004 16:55:47 +0000 (18:55 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 4 Jul 2004 16:55:47 +0000 (18:55 +0200)
Allocate the memory for .kobj.k_name and make use of kobject_init() for
the fake device that is needed for firmware loading.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/bt3c_cs.c

index e298846835ef03873bd7519b44462509f71c00b9..c7fccd3bfe467fa9430a18c6877a72255d4c64e6 100644 (file)
@@ -488,12 +488,19 @@ static int bt3c_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long
 /* ======================== Card services HCI interaction ======================== */
 
 
-static struct device bt3c_device = {
-       .bus_id = "pcmcia",
-       .kobj = {
-               .k_name = "bt3c"
-       }
-};
+static struct device *bt3c_device(void)
+{
+       static char *kobj_name = "bt3c";
+
+       static struct device dev = {
+               .bus_id = "pcmcia",
+       };
+       dev.kobj.k_name = kmalloc(strlen(kobj_name) + 1, GFP_KERNEL);
+       strcpy(dev.kobj.k_name, kobj_name);
+       kobject_init(&dev.kobj);
+
+       return &dev;
+}
 
 
 static int bt3c_load_firmware(bt3c_info_t *info, unsigned char *firmware, int count)
@@ -616,7 +623,7 @@ int bt3c_open(bt3c_info_t *info)
        hdev->owner = THIS_MODULE;
 
        /* Load firmware */
-       err = request_firmware(&firmware, "BT3CPCC.bin", &bt3c_device);
+       err = request_firmware(&firmware, "BT3CPCC.bin", bt3c_device());
        if (err < 0) {
                BT_ERR("Firmware request failed");
                goto error;