Skip to content

Commit 6845667

Browse files
Yuuoniyholtmann
authored andcommitted
Bluetooth: hci_qca: Fix NULL vs IS_ERR_OR_NULL check in qca_serdev_probe
The function devm_gpiod_get_index() return error pointers on error. Thus devm_gpiod_get_index_optional() could return NULL and error pointers. The same as devm_gpiod_get_optional() function. Using IS_ERR_OR_NULL() check to catch error pointers. Fixes: 77131df ("Bluetooth: hci_qca: Replace devm_gpiod_get() with devm_gpiod_get_optional()") Signed-off-by: Miaoqian Lin <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent b38cd3b commit 6845667

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/bluetooth/hci_qca.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,14 +2059,14 @@ static int qca_serdev_probe(struct serdev_device *serdev)
20592059

20602060
qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
20612061
GPIOD_OUT_LOW);
2062-
if (!qcadev->bt_en && data->soc_type == QCA_WCN6750) {
2062+
if (IS_ERR_OR_NULL(qcadev->bt_en) && data->soc_type == QCA_WCN6750) {
20632063
dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n");
20642064
power_ctrl_enabled = false;
20652065
}
20662066

20672067
qcadev->sw_ctrl = devm_gpiod_get_optional(&serdev->dev, "swctrl",
20682068
GPIOD_IN);
2069-
if (!qcadev->sw_ctrl && data->soc_type == QCA_WCN6750)
2069+
if (IS_ERR_OR_NULL(qcadev->sw_ctrl) && data->soc_type == QCA_WCN6750)
20702070
dev_warn(&serdev->dev, "failed to acquire SW_CTRL gpio\n");
20712071

20722072
qcadev->susclk = devm_clk_get_optional(&serdev->dev, NULL);
@@ -2088,7 +2088,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
20882088

20892089
qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
20902090
GPIOD_OUT_LOW);
2091-
if (!qcadev->bt_en) {
2091+
if (IS_ERR_OR_NULL(qcadev->bt_en)) {
20922092
dev_warn(&serdev->dev, "failed to acquire enable gpio\n");
20932093
power_ctrl_enabled = false;
20942094
}

0 commit comments

Comments
 (0)