[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210501150445.4055-1-paskripkin@gmail.com>
Date: Sat, 1 May 2021 18:04:45 +0300
From: Pavel Skripkin <paskripkin@...il.com>
To: marcel@...tmann.org, johan.hedberg@...il.com
Cc: luiz.dentz@...il.com, linux-bluetooth@...r.kernel.org,
linux-kernel@...r.kernel.org, Pavel Skripkin <paskripkin@...il.com>
Subject: [PATCH] bluetooth: fix potential gfp
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 gfp.
Signed-off-by: Pavel Skripkin <paskripkin@...il.com>
---
drivers/bluetooth/hci_qca.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index de36af63e182..9589ef6c0c26 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1820,8 +1820,6 @@ static void qca_power_shutdown(struct hci_uart *hu)
unsigned long flags;
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
* still open, stop queueing the IBS data and flush all the buffered
* data in skb's.
@@ -1837,6 +1835,8 @@ static void qca_power_shutdown(struct hci_uart *hu)
if (!hu->serdev)
return;
+ qcadev = serdev_device_get_drvdata(hu->serdev);
+
if (qca_is_wcn399x(soc_type)) {
host_set_baudrate(hu, 2400);
qca_send_power_pulse(hu, false);
--
2.31.1
Powered by blists - more mailing lists