* [PATCH] Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional()
@ 2024-02-08 16:40 Bartosz Golaszewski
2024-02-08 17:34 ` bluez.test.bot
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2024-02-08 16:40 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Miaoqian Lin
Cc: linux-bluetooth, linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
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: 6845667146a2 ("Bluetooth: hci_qca: Fix NULL vs IS_ERR_OR_NULL check in qca_serdev_probe")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/bluetooth/hci_qca.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index edd2a81b4d5e..8a60ad7acd70 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2326,7 +2326,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
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_WCN6855)) {
dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n");
@@ -2335,7 +2335,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
qcadev->sw_ctrl = devm_gpiod_get_optional(&serdev->dev, "swctrl",
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_WCN6855 ||
data->soc_type == QCA_WCN7850))
@@ -2357,7 +2357,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
default:
qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
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");
power_ctrl_enabled = false;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional()
2024-02-08 16:40 [PATCH] Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional() Bartosz Golaszewski
@ 2024-02-08 17:34 ` bluez.test.bot
2024-02-22 19:27 ` [PATCH] " Bartosz Golaszewski
2024-02-22 21:20 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2024-02-08 17:34 UTC (permalink / raw)
To: linux-bluetooth, brgl
[-- Attachment #1: Type: text/plain, Size: 1936 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=824386
---Test result---
Test Summary:
CheckPatch PASS 1.18 seconds
GitLint PASS 0.20 seconds
SubjectPrefix PASS 0.07 seconds
BuildKernel PASS 27.94 seconds
CheckAllWarning PASS 30.43 seconds
CheckSparse PASS 36.13 seconds
CheckSmatch PASS 97.84 seconds
BuildKernel32 PASS 26.85 seconds
TestRunnerSetup PASS 499.91 seconds
TestRunner_l2cap-tester PASS 39.72 seconds
TestRunner_iso-tester PASS 30.92 seconds
TestRunner_bnep-tester PASS 4.94 seconds
TestRunner_mgmt-tester FAIL 174.03 seconds
TestRunner_rfcomm-tester PASS 7.44 seconds
TestRunner_sco-tester PASS 14.98 seconds
TestRunner_ioctl-tester PASS 7.93 seconds
TestRunner_mesh-tester PASS 5.89 seconds
TestRunner_smp-tester PASS 6.86 seconds
TestRunner_userchan-tester PASS 5.00 seconds
IncrementalBuild PASS 26.04 seconds
Details
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 492, Passed: 487 (99.0%), Failed: 4, Not Run: 1
Failed Test Cases
LL Privacy - Add Device 4 (2 Devices to AL) Failed 0.114 seconds
LL Privacy - Add Device 5 (2 Devices to RL) Failed 0.115 seconds
LL Privacy - Add Device 6 (RL is full) Failed 0.142 seconds
LL Privacy - Add Device 7 (AL is full) Failed 0.147 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional()
2024-02-08 16:40 [PATCH] Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional() Bartosz Golaszewski
2024-02-08 17:34 ` bluez.test.bot
@ 2024-02-22 19:27 ` Bartosz Golaszewski
2024-02-22 21:20 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2024-02-22 19:27 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Miaoqian Lin
Cc: linux-bluetooth, linux-kernel, Bartosz Golaszewski
On Thu, Feb 8, 2024 at 5:40 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> 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: 6845667146a2 ("Bluetooth: hci_qca: Fix NULL vs IS_ERR_OR_NULL check in qca_serdev_probe")
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
> drivers/bluetooth/hci_qca.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index edd2a81b4d5e..8a60ad7acd70 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -2326,7 +2326,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
>
> qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
> 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_WCN6855)) {
> dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n");
> @@ -2335,7 +2335,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
>
> qcadev->sw_ctrl = devm_gpiod_get_optional(&serdev->dev, "swctrl",
> 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_WCN6855 ||
> data->soc_type == QCA_WCN7850))
> @@ -2357,7 +2357,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
> default:
> qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
> 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");
> power_ctrl_enabled = false;
> }
> --
> 2.40.1
>
Gentle ping.
Bartosz
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional()
2024-02-08 16:40 [PATCH] Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional() Bartosz Golaszewski
2024-02-08 17:34 ` bluez.test.bot
2024-02-22 19:27 ` [PATCH] " Bartosz Golaszewski
@ 2024-02-22 21:20 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2024-02-22 21:20 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: marcel, luiz.dentz, linmq006, linux-bluetooth, linux-kernel,
bartosz.golaszewski
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 8 Feb 2024 17:40:17 +0100 you wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> 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.
>
> [...]
Here is the summary with links:
- Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional()
https://git.kernel.org/bluetooth/bluetooth-next/c/75518da8cf76
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-22 21:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-08 16:40 [PATCH] Bluetooth: hci_qca: don't use IS_ERR_OR_NULL() with gpiod_get_optional() Bartosz Golaszewski
2024-02-08 17:34 ` bluez.test.bot
2024-02-22 19:27 ` [PATCH] " Bartosz Golaszewski
2024-02-22 21:20 ` patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).