Skip to content

Commit 56d074d

Browse files
Bartosz GolaszewskiVudentz
authored andcommitted
Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional()
The optional variants for the gpiod_get() family of functions return NULL if the GPIO in question is not associated with this device. They return ERR_PTR() on any other error. NULL descriptors are graciously handled by GPIOLIB and can be safely passed to any of the GPIO consumer interfaces as they will return 0 and act as if the function succeeded. If one is using the optional variant, then there's no point in checking for NULL. Fixes: 6845667 ("Bluetooth: hci_qca: Fix NULL vs IS_ERR_OR_NULL check in qca_serdev_probe") Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent a7ba218 commit 56d074d

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
@@ -2326,7 +2326,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
23262326

23272327
qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
23282328
GPIOD_OUT_LOW);
2329-
if (IS_ERR_OR_NULL(qcadev->bt_en) &&
2329+
if (IS_ERR(qcadev->bt_en) &&
23302330
(data->soc_type == QCA_WCN6750 ||
23312331
data->soc_type == QCA_WCN6855)) {
23322332
dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n");
@@ -2335,7 +2335,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
23352335

23362336
qcadev->sw_ctrl = devm_gpiod_get_optional(&serdev->dev, "swctrl",
23372337
GPIOD_IN);
2338-
if (IS_ERR_OR_NULL(qcadev->sw_ctrl) &&
2338+
if (IS_ERR(qcadev->sw_ctrl) &&
23392339
(data->soc_type == QCA_WCN6750 ||
23402340
data->soc_type == QCA_WCN6855 ||
23412341
data->soc_type == QCA_WCN7850))
@@ -2357,7 +2357,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
23572357
default:
23582358
qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
23592359
GPIOD_OUT_LOW);
2360-
if (IS_ERR_OR_NULL(qcadev->bt_en)) {
2360+
if (IS_ERR(qcadev->bt_en)) {
23612361
dev_warn(&serdev->dev, "failed to acquire enable gpio\n");
23622362
power_ctrl_enabled = false;
23632363
}

0 commit comments

Comments
 (0)