Bluetooth: hci_qca: Add helper function to get the chip family
authorMatthias Kaehlcke <mka@chromium.org>
Mon, 11 Mar 2019 18:38:31 +0000 (11:38 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 23 Apr 2019 16:09:07 +0000 (18:09 +0200)
commit4fdd5a4f8b4407c21897dbfba9d0ee77eb80a42c
treeca09ef8d7b5514ac0ea040f8ceae93bf0ebd6429
parent9aebfd4a2200ab8075e44379c758bccefdc589bb
Bluetooth: hci_qca: Add helper function to get the chip family

Many functions obtain a 'struct qca_serdev' only to read the btsoc_type
field. Add a helper function that encapsulates this.

This also fixes crashes observed on platforms with ROME controllers
that are instantiated through ldisc and not as serdev clients. The
crashes are caused by NULL pointer dereferentiations, which stem from
the driver's assumption that a QCA HCI device is always associated with
a serdev device.

Fixes: fa9ad876b8e0 ("Bluetooth: hci_qca: Add support for Qualcomm Bluetooth chip wcn3990")
Reported-by: Balakrishna Godavarthi <bgodavar@codeaurora.org>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/hci_qca.c