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

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: c01d5cc9b9 ("wifi: ath12k: Power up userPD")
Fixes: 6cee30f0da ("wifi: ath12k: add AHB driver support for IPQ5332")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/937abc74-9648-4c05-a2c3-8db408b3ed9e@stanley.mountain
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
This commit is contained in:
Dan Carpenter 2025-04-10 19:26:16 +03:00 committed by Jeff Johnson
parent d118047f82
commit 4703416d0f

View File

@ -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;