Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30a754fa authored by Ayaz Ahmad's avatar Ayaz Ahmad
Browse files

radio: iris: Avoid NULL pointer dereferencing



Before dereferencing a pointer check for NULL
pointer.

CRs-Fixed: 537890
Signed-off-by: default avatarAyaz Ahmad <aahmad@codeaurora.org>
Change-Id: If010b89fd4f5930d944c9e327c51de4b40f33c3c
parent 06300feb
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -153,7 +153,13 @@ static int radio_hci_smd_register_dev(struct radio_data *hsmd)
	struct radio_hci_dev *hdev;
	int rc;

	if (hsmd == NULL)
		return -ENODEV;

	hdev = kmalloc(sizeof(struct radio_hci_dev), GFP_KERNEL);
	if (hdev == NULL)
		return -ENODEV;

	hsmd->hdev = hdev;
	tasklet_init(&hsmd->rx_task, radio_hci_smd_recv_event,
		(unsigned long) hsmd);
@@ -166,6 +172,8 @@ static int radio_hci_smd_register_dev(struct radio_data *hsmd)

	if (rc < 0) {
		FMDERR("Cannot open the command channel");
		hsmd->hdev = NULL;
		kfree(hdev);
		return -ENODEV;
	}

@@ -173,6 +181,9 @@ static int radio_hci_smd_register_dev(struct radio_data *hsmd)

	if (radio_hci_register_dev(hdev) < 0) {
		FMDERR("Can't register HCI device");
		smd_close(hsmd->fm_channel);
		hsmd->hdev = NULL;
		kfree(hdev);
		return -ENODEV;
	}