This code has an uninitialized variable warning:
drivers/bluetooth/btmtkuart.c:184 mtk_hci_wmt_sync()
error: uninitialized symbol 'wc'.
But it also has error paths which have memory leaks.
Fixes:
8f550f55b155 ("Bluetooth: btmtkuart: rely on BT_MTK module")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
}
wc = kzalloc(hlen, GFP_KERNEL);
- if (!wc)
- return -ENOMEM;
+ if (!wc) {
+ err = -ENOMEM;
+ goto err_free_skb;
+ }
hdr = &wc->hdr;
hdr->dir = 1;
bt_dev_err(hdev, "Wrong op received %d expected %d",
wmt_evt->whdr.op, hdr->op);
err = -EIO;
- goto err_free_skb;
+ goto err_free_wc;
}
switch (wmt_evt->whdr.op) {
if (wmt_params->status)
*wmt_params->status = status;
+err_free_wc:
+ kfree(wc);
err_free_skb:
kfree_skb(bdev->evt_skb);
bdev->evt_skb = NULL;
-err_free_wc:
- kfree(wc);
return err;
}