Commit 59f90f13 authored by Pavel Skripkin's avatar Pavel Skripkin Committed by Marcel Holtmann

Bluetooth: hci_qca: fix potential GPF

In qca_power_shutdown() qcadev local variable is
initialized by hu->serdev.dev private data, but
hu->serdev can be NULL and there is a check for it.

Since, qcadev is not used before

	if (!hu->serdev)
		return;

we can move its initialization after this "if" to
prevent GPF.

Fixes: 5559904c ("Bluetooth: hci_qca: Add QCA Rome power off support to the qca_power_shutdown()")
Cc: stable@vger.kernel.org # v5.6+
Cc: Rocky Liao <rjliao@codeaurora.org>
Signed-off-by: default avatarPavel Skripkin <paskripkin@gmail.com>
Reviewed-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 4ef36a52
...@@ -1835,8 +1835,6 @@ static void qca_power_shutdown(struct hci_uart *hu) ...@@ -1835,8 +1835,6 @@ static void qca_power_shutdown(struct hci_uart *hu)
unsigned long flags; unsigned long flags;
enum qca_btsoc_type soc_type = qca_soc_type(hu); enum qca_btsoc_type soc_type = qca_soc_type(hu);
qcadev = serdev_device_get_drvdata(hu->serdev);
/* From this point we go into power off state. But serial port is /* From this point we go into power off state. But serial port is
* still open, stop queueing the IBS data and flush all the buffered * still open, stop queueing the IBS data and flush all the buffered
* data in skb's. * data in skb's.
...@@ -1852,6 +1850,8 @@ static void qca_power_shutdown(struct hci_uart *hu) ...@@ -1852,6 +1850,8 @@ static void qca_power_shutdown(struct hci_uart *hu)
if (!hu->serdev) if (!hu->serdev)
return; return;
qcadev = serdev_device_get_drvdata(hu->serdev);
if (qca_is_wcn399x(soc_type)) { if (qca_is_wcn399x(soc_type)) {
host_set_baudrate(hu, 2400); host_set_baudrate(hu, 2400);
qca_send_power_pulse(hu, false); qca_send_power_pulse(hu, false);
......
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