* [PATCH] wifi: ath10k: Drop redundant NULL check on devm_clk_get()
@ 2026-07-05 17:24 Krzysztof Kozlowski
2026-07-13 1:53 ` Baochen Qiang
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-05 17:24 UTC (permalink / raw)
To: Jeff Johnson, linux-wireless, ath10k, linux-kernel; +Cc: Krzysztof Kozlowski
devm_clk_get() does not return NULL (only valid clock or ERR pointer),
so simplify the code to drop redundant IS_ERR_OR_NULL().
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/ahb.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c
index eb8b35b6224d..7456f885d2b5 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -87,24 +87,24 @@ static int ath10k_ahb_clock_init(struct ath10k *ar)
dev = &ar_ahb->pdev->dev;
ar_ahb->cmd_clk = devm_clk_get(dev, "wifi_wcss_cmd");
- if (IS_ERR_OR_NULL(ar_ahb->cmd_clk)) {
+ if (IS_ERR(ar_ahb->cmd_clk)) {
ath10k_err(ar, "failed to get cmd clk: %ld\n",
PTR_ERR(ar_ahb->cmd_clk));
- return ar_ahb->cmd_clk ? PTR_ERR(ar_ahb->cmd_clk) : -ENODEV;
+ return PTR_ERR(ar_ahb->cmd_clk);
}
ar_ahb->ref_clk = devm_clk_get(dev, "wifi_wcss_ref");
- if (IS_ERR_OR_NULL(ar_ahb->ref_clk)) {
+ if (IS_ERR(ar_ahb->ref_clk)) {
ath10k_err(ar, "failed to get ref clk: %ld\n",
PTR_ERR(ar_ahb->ref_clk));
- return ar_ahb->ref_clk ? PTR_ERR(ar_ahb->ref_clk) : -ENODEV;
+ return PTR_ERR(ar_ahb->ref_clk);
}
ar_ahb->rtc_clk = devm_clk_get(dev, "wifi_wcss_rtc");
- if (IS_ERR_OR_NULL(ar_ahb->rtc_clk)) {
+ if (IS_ERR(ar_ahb->rtc_clk)) {
ath10k_err(ar, "failed to get rtc clk: %ld\n",
PTR_ERR(ar_ahb->rtc_clk));
- return ar_ahb->rtc_clk ? PTR_ERR(ar_ahb->rtc_clk) : -ENODEV;
+ return PTR_ERR(ar_ahb->rtc_clk);
}
return 0;
--
2.53.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wifi: ath10k: Drop redundant NULL check on devm_clk_get()
2026-07-05 17:24 [PATCH] wifi: ath10k: Drop redundant NULL check on devm_clk_get() Krzysztof Kozlowski
@ 2026-07-13 1:53 ` Baochen Qiang
2026-07-13 22:31 ` Jeff Johnson
2026-07-14 18:08 ` Jeff Johnson
2 siblings, 0 replies; 5+ messages in thread
From: Baochen Qiang @ 2026-07-13 1:53 UTC (permalink / raw)
To: Krzysztof Kozlowski, Jeff Johnson, linux-wireless, ath10k, linux-kernel
On 7/6/2026 1:24 AM, Krzysztof Kozlowski wrote:
> devm_clk_get() does not return NULL (only valid clock or ERR pointer),
> so simplify the code to drop redundant IS_ERR_OR_NULL().
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wifi: ath10k: Drop redundant NULL check on devm_clk_get()
2026-07-05 17:24 [PATCH] wifi: ath10k: Drop redundant NULL check on devm_clk_get() Krzysztof Kozlowski
2026-07-13 1:53 ` Baochen Qiang
@ 2026-07-13 22:31 ` Jeff Johnson
2026-07-15 4:47 ` Krzysztof Kozlowski
2026-07-14 18:08 ` Jeff Johnson
2 siblings, 1 reply; 5+ messages in thread
From: Jeff Johnson @ 2026-07-13 22:31 UTC (permalink / raw)
To: Krzysztof Kozlowski, Jeff Johnson, linux-wireless, ath10k, linux-kernel
On 7/5/2026 10:24 AM, Krzysztof Kozlowski wrote:
> devm_clk_get() does not return NULL (only valid clock or ERR pointer),
> so simplify the code to drop redundant IS_ERR_OR_NULL().
FWIW my AI review agent says:
Under !CONFIG_HAVE_CLK (x86 COMPILE_TEST), devm_clk_get() returns NULL;
IS_ERR(NULL) is false so clock_init() returns 0 with NULL clocks stored
Perhaps the stub function in include/linux/clk.h should be updated to return
an ERR_PTR() instead of NULL?
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> ---
> drivers/net/wireless/ath/ath10k/ahb.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c
> index eb8b35b6224d..7456f885d2b5 100644
> --- a/drivers/net/wireless/ath/ath10k/ahb.c
> +++ b/drivers/net/wireless/ath/ath10k/ahb.c
> @@ -87,24 +87,24 @@ static int ath10k_ahb_clock_init(struct ath10k *ar)
> dev = &ar_ahb->pdev->dev;
>
> ar_ahb->cmd_clk = devm_clk_get(dev, "wifi_wcss_cmd");
> - if (IS_ERR_OR_NULL(ar_ahb->cmd_clk)) {
> + if (IS_ERR(ar_ahb->cmd_clk)) {
> ath10k_err(ar, "failed to get cmd clk: %ld\n",
> PTR_ERR(ar_ahb->cmd_clk));
> - return ar_ahb->cmd_clk ? PTR_ERR(ar_ahb->cmd_clk) : -ENODEV;
> + return PTR_ERR(ar_ahb->cmd_clk);
> }
>
> ar_ahb->ref_clk = devm_clk_get(dev, "wifi_wcss_ref");
> - if (IS_ERR_OR_NULL(ar_ahb->ref_clk)) {
> + if (IS_ERR(ar_ahb->ref_clk)) {
> ath10k_err(ar, "failed to get ref clk: %ld\n",
> PTR_ERR(ar_ahb->ref_clk));
> - return ar_ahb->ref_clk ? PTR_ERR(ar_ahb->ref_clk) : -ENODEV;
> + return PTR_ERR(ar_ahb->ref_clk);
> }
>
> ar_ahb->rtc_clk = devm_clk_get(dev, "wifi_wcss_rtc");
> - if (IS_ERR_OR_NULL(ar_ahb->rtc_clk)) {
> + if (IS_ERR(ar_ahb->rtc_clk)) {
> ath10k_err(ar, "failed to get rtc clk: %ld\n",
> PTR_ERR(ar_ahb->rtc_clk));
> - return ar_ahb->rtc_clk ? PTR_ERR(ar_ahb->rtc_clk) : -ENODEV;
> + return PTR_ERR(ar_ahb->rtc_clk);
> }
>
> return 0;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wifi: ath10k: Drop redundant NULL check on devm_clk_get()
2026-07-05 17:24 [PATCH] wifi: ath10k: Drop redundant NULL check on devm_clk_get() Krzysztof Kozlowski
2026-07-13 1:53 ` Baochen Qiang
2026-07-13 22:31 ` Jeff Johnson
@ 2026-07-14 18:08 ` Jeff Johnson
2 siblings, 0 replies; 5+ messages in thread
From: Jeff Johnson @ 2026-07-14 18:08 UTC (permalink / raw)
To: Jeff Johnson, linux-wireless, ath10k, linux-kernel, Krzysztof Kozlowski
On Sun, 05 Jul 2026 19:24:06 +0200, Krzysztof Kozlowski wrote:
> devm_clk_get() does not return NULL (only valid clock or ERR pointer),
> so simplify the code to drop redundant IS_ERR_OR_NULL().
>
>
Applied, thanks!
[1/1] wifi: ath10k: Drop redundant NULL check on devm_clk_get()
commit: 298b337bb1d450793ed5248cc0345694f73f057c
Best regards,
--
Jeff Johnson <jeff.johnson@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wifi: ath10k: Drop redundant NULL check on devm_clk_get()
2026-07-13 22:31 ` Jeff Johnson
@ 2026-07-15 4:47 ` Krzysztof Kozlowski
0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-15 4:47 UTC (permalink / raw)
To: Jeff Johnson, Jeff Johnson, linux-wireless, ath10k, linux-kernel
On 14/07/2026 00:31, Jeff Johnson wrote:
> On 7/5/2026 10:24 AM, Krzysztof Kozlowski wrote:
>> devm_clk_get() does not return NULL (only valid clock or ERR pointer),
>> so simplify the code to drop redundant IS_ERR_OR_NULL().
>
> FWIW my AI review agent says:
> Under !CONFIG_HAVE_CLK (x86 COMPILE_TEST), devm_clk_get() returns NULL;
> IS_ERR(NULL) is false so clock_init() returns 0 with NULL clocks stored
>
> Perhaps the stub function in include/linux/clk.h should be updated to return
> an ERR_PTR() instead of NULL?
>
Yes, that's on my todo list.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-07-15 4:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-05 17:24 [PATCH] wifi: ath10k: Drop redundant NULL check on devm_clk_get() Krzysztof Kozlowski
2026-07-13 1:53 ` Baochen Qiang
2026-07-13 22:31 ` Jeff Johnson
2026-07-15 4:47 ` Krzysztof Kozlowski
2026-07-14 18:08 ` Jeff Johnson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox