diff mbox series

[next] wifi: ath12k: Fix a couple NULL vs IS_ERR() bugs

Message ID 937abc74-9648-4c05-a2c3-8db408b3ed9e@stanley.mountain (mailing list archive)
State Accepted
Delegated to: Jeff Johnson
Headers show
Series [next] wifi: ath12k: Fix a couple NULL vs IS_ERR() bugs | expand

Checks

Context Check Description
wifibot/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Dan Carpenter April 10, 2025, 4:26 p.m. UTC
The devm_memremap() function returns error pointers on error and the
ioremap() function returns NULL on error.  The error checking here got
those flipped around.

Fixes: c01d5cc9b9fe ("wifi: ath12k: Power up userPD")
Fixes: 6cee30f0da75 ("wifi: ath12k: add AHB driver support for IPQ5332")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/net/wireless/ath/ath12k/ahb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Vasanthakumar Thiagarajan April 10, 2025, 5:06 p.m. UTC | #1
On 4/10/2025 9:56 PM, Dan Carpenter wrote:
> The devm_memremap() function returns error pointers on error and the
> ioremap() function returns NULL on error.  The error checking here got
> those flipped around.
> 
> Fixes: c01d5cc9b9fe ("wifi: ath12k: Power up userPD")
> Fixes: 6cee30f0da75 ("wifi: ath12k: add AHB driver support for IPQ5332")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>   drivers/net/wireless/ath/ath12k/ahb.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/ath/ath12k/ahb.c
> index a9d9943a73f4..636dfe237a79 100644
> --- a/drivers/net/wireless/ath/ath12k/ahb.c
> +++ b/drivers/net/wireless/ath/ath12k/ahb.c
> @@ -360,10 +360,10 @@ static int ath12k_ahb_power_up(struct ath12k_base *ab)
>   	mem_phys = rmem->base;
>   	mem_size = rmem->size;
>   	mem_region = devm_memremap(dev, mem_phys, mem_size, MEMREMAP_WC);
> -	if (!mem_region) {
> +	if (IS_ERR(mem_region)) {
>   		ath12k_err(ab, "unable to map memory region: %pa+%pa\n",
>   			   &rmem->base, &rmem->size);
> -		return -ENOMEM;
> +		return PTR_ERR(mem_region);
>   	}
>   
>   	snprintf(fw_name, sizeof(fw_name), "%s/%s/%s%d%s", ATH12K_FW_DIR,
> @@ -929,7 +929,7 @@ static int ath12k_ahb_resource_init(struct ath12k_base *ab)
>   		 * for accessing them.
>   		 */
>   		ab->mem_ce = ioremap(ce_remap->base, ce_remap->size);
> -		if (IS_ERR(ab->mem_ce)) {
> +		if (!ab->mem_ce) {
>   			dev_err(&pdev->dev, "ce ioremap error\n");
>   			ret = -ENOMEM;
>   			goto err_mem_unmap;

Thanks for fixing it.

Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Jeff Johnson April 12, 2025, 4:24 a.m. UTC | #2
On Thu, 10 Apr 2025 19:26:16 +0300, Dan Carpenter wrote:
> The devm_memremap() function returns error pointers on error and the
> ioremap() function returns NULL on error.  The error checking here got
> those flipped around.
> 
> 

Applied, thanks!

[1/1] wifi: ath12k: Fix a couple NULL vs IS_ERR() bugs
      commit: 4703416d0fb993f7505025667f868f6981a5f7ab

Best regards,
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/ath/ath12k/ahb.c
index a9d9943a73f4..636dfe237a79 100644
--- a/drivers/net/wireless/ath/ath12k/ahb.c
+++ b/drivers/net/wireless/ath/ath12k/ahb.c
@@ -360,10 +360,10 @@  static int ath12k_ahb_power_up(struct ath12k_base *ab)
 	mem_phys = rmem->base;
 	mem_size = rmem->size;
 	mem_region = devm_memremap(dev, mem_phys, mem_size, MEMREMAP_WC);
-	if (!mem_region) {
+	if (IS_ERR(mem_region)) {
 		ath12k_err(ab, "unable to map memory region: %pa+%pa\n",
 			   &rmem->base, &rmem->size);
-		return -ENOMEM;
+		return PTR_ERR(mem_region);
 	}
 
 	snprintf(fw_name, sizeof(fw_name), "%s/%s/%s%d%s", ATH12K_FW_DIR,
@@ -929,7 +929,7 @@  static int ath12k_ahb_resource_init(struct ath12k_base *ab)
 		 * for accessing them.
 		 */
 		ab->mem_ce = ioremap(ce_remap->base, ce_remap->size);
-		if (IS_ERR(ab->mem_ce)) {
+		if (!ab->mem_ce) {
 			dev_err(&pdev->dev, "ce ioremap error\n");
 			ret = -ENOMEM;
 			goto err_mem_unmap;