Commit 56d074d2 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Luiz Augusto von Dentz

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: 68456671 ("Bluetooth: hci_qca: Fix NULL vs IS_ERR_OR_NULL check in qca_serdev_probe")
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
parent a7ba218a
...@@ -2326,7 +2326,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) ...@@ -2326,7 +2326,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable", qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
GPIOD_OUT_LOW); GPIOD_OUT_LOW);
if (IS_ERR_OR_NULL(qcadev->bt_en) && if (IS_ERR(qcadev->bt_en) &&
(data->soc_type == QCA_WCN6750 || (data->soc_type == QCA_WCN6750 ||
data->soc_type == QCA_WCN6855)) { data->soc_type == QCA_WCN6855)) {
dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n"); dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n");
...@@ -2335,7 +2335,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) ...@@ -2335,7 +2335,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
qcadev->sw_ctrl = devm_gpiod_get_optional(&serdev->dev, "swctrl", qcadev->sw_ctrl = devm_gpiod_get_optional(&serdev->dev, "swctrl",
GPIOD_IN); GPIOD_IN);
if (IS_ERR_OR_NULL(qcadev->sw_ctrl) && if (IS_ERR(qcadev->sw_ctrl) &&
(data->soc_type == QCA_WCN6750 || (data->soc_type == QCA_WCN6750 ||
data->soc_type == QCA_WCN6855 || data->soc_type == QCA_WCN6855 ||
data->soc_type == QCA_WCN7850)) data->soc_type == QCA_WCN7850))
...@@ -2357,7 +2357,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) ...@@ -2357,7 +2357,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
default: default:
qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable", qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
GPIOD_OUT_LOW); GPIOD_OUT_LOW);
if (IS_ERR_OR_NULL(qcadev->bt_en)) { if (IS_ERR(qcadev->bt_en)) {
dev_warn(&serdev->dev, "failed to acquire enable gpio\n"); dev_warn(&serdev->dev, "failed to acquire enable gpio\n");
power_ctrl_enabled = false; power_ctrl_enabled = 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