Bluetooth: hci_sync: Fix crash on NULL parent

Although later functions can handle a NULL fwnode, fwnode can't handle
being passed a NULL pointer.

See: https://github.com/raspberrypi/linux/issues/6305

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
This commit is contained in:
Phil Elwell
2024-08-07 17:41:31 +01:00
committed by Dom Cobley
parent 303cede9b0
commit db93c890a4

View File

@@ -4950,7 +4950,8 @@ static const struct {
*/ */
static int hci_dev_setup_sync(struct hci_dev *hdev) static int hci_dev_setup_sync(struct hci_dev *hdev)
{ {
struct fwnode_handle *fwnode = dev_fwnode(hdev->dev.parent); struct fwnode_handle *fwnode =
hdev->dev.parent ? dev_fwnode(hdev->dev.parent) : NULL;
int ret = 0; int ret = 0;
bool invalid_bdaddr; bool invalid_bdaddr;
size_t i; size_t i;