Commit 5d681f99 authored by Marcel Holtmann's avatar Marcel Holtmann

[Bluetooth] Fix kobject oops on firmware loading

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: default avatarMarcel Holtmann <marcel@holtmann.org>
parent c1656683
......@@ -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 = {
static struct device *bt3c_device(void)
{
static char *kobj_name = "bt3c";
static struct device dev = {
.bus_id = "pcmcia",
.kobj = {
.k_name = "bt3c"
}
};
};
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment