Skip to contentSkip to conversation

bluetooth: hci_qca: Fix suspend/resume functionality failure

PATCH In review Zijun Hu 3 participants 3 messages May 28, 2020 – May 29, 2020

Subsystems (3)
lore
Share & tools
lore

Zijun Hu

author
#0 lore raw

PATCH v2 1/1 bluetooth: hci_qca: Fix suspend/resume functionality failure

@dev parameter of qca_suspend()/qca_resume() represents serdev_device, but it is mistook for hci_dev and causes succedent unexpected memory access.

Fix by taking @dev as serdev_device.

Fixes 41d5b25fed0 ("Bluetooth: hci_qca: add PM support")

---
Changes in v2:
- remove unused variable @hdev

 drivers/bluetooth/hci_qca.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/bluetooth/hci_qca.c +6 -4
index e4a6823..adcbe00 100644
@@ -1977,8 +1977,9 @@ static void qca_serdev_remove(struct serdev_device *serdev)
 
 static int __maybe_unused qca_suspend(struct device *dev)
 {
-	struct hci_dev *hdev = container_of(dev, struct hci_dev, dev);
-	struct hci_uart *hu = hci_get_drvdata(hdev);
+	struct serdev_device *serdev = to_serdev_device(dev);
+	struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev);
+	struct hci_uart *hu = &qcadev->serdev_hu;
 	struct qca_data *qca = hu->priv;
 	unsigned long flags;
 	int ret = 0;
@@ -2057,8 +2058,9 @@ static int __maybe_unused qca_suspend(struct device *dev)
 
 static int __maybe_unused qca_resume(struct device *dev)
 {
-	struct hci_dev *hdev = container_of(dev, struct hci_dev, dev);
-	struct hci_uart *hu = hci_get_drvdata(hdev);
+	struct serdev_device *serdev = to_serdev_device(dev);
+	struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev);
+	struct hci_uart *hu = &qcadev->serdev_hu;
 	struct qca_data *qca = hu->priv;
 
 	clear_bit(QCA_SUSPENDING, &qca->flags);
Signature · 1 line
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
maintainer
#2 lore raw
In reply to Zijun Hu

Hi Zijun,

Quoted 6 lines

@dev parameter of qca_suspend()/qca_resume() represents serdev_device, but it is mistook for hci_dev and causes succedent unexpected memory access.

Fix by taking @dev as serdev_device.

Quoted 8 lines
Fixes 41d5b25fed0 ("Bluetooth: hci_qca: add PM support")

---
Changes in v2:
- remove unused variable @hdev

drivers/bluetooth/hci_qca.c | 10 ++++++----

1 file changed, 6 insertions(+), 4 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel