From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0DAD22D4DC for ; Mon, 8 Dec 2025 20:04:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765224295; cv=none; b=aUKaVTBPWvKrUQ1VKpI6drFHBW3kZMoCWQlF1iMCphoHWtsLwW8zXKMvY7en0p/zi2yJQ8il/Qsh6FxdrqIgysMyxu4Vq1DF8eotAN0nK1Y88QlFzpzKTLNd49YmqdjQKieAH88p71G09FzOMoceknJM7OFEAzrffTNpHpL648w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765224295; c=relaxed/simple; bh=skKjEfBaMU6Lqt5vjsIobNng9NkDUQtxDFU5ZUjwvRo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=D4uxUdtt5Vrh1CCaJ0KpN/hOLZXWOh6ss7yh2cmGEl8DwdivL381WrOD54D9ilc47YaAW+DjOG8HsUhASYD5Ongn5+wa06w1QibIgB+ObnGH3PbKTeEDoR35Jkg78AP0+csrtHt0WQRNenjfe6VqczuoYEON5voNEImdAaKC4Do= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MeEIS0G7; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MeEIS0G7" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4779a637712so36193855e9.1 for ; Mon, 08 Dec 2025 12:04:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765224291; x=1765829091; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=d9WaSQQ0PkGqeHp9LL2kJRaAe2H4lpRnuEoZ98r23rw=; b=MeEIS0G7PiMgjbTOTLGE6XhhpJGtxjfb37lIXHx8l1yWXKyfcRu7DTqlNUR6T225Vk vOjbrWKOfZPeUSIr+mbYGZbRAUlCJUoo1SWWZHm2CjpAYUMXy/HDI1wK+3m5pfKqSzLZ kYmPGgsTku7Q8Yf3Lr2YOT9yhIE2pbqVzrpX+zjLlkt8Xw08+30/muL3qx8adXiTcpxv f9NYz7iIFI0CYwicFBCarscDQyM4CZ/Vk+DkRdygPDIKorAym6JtXna46bgjEyyudtHY I/u9EVhO+Q7o6mb6v2+LWmfw72JI95MLKyBag2tD/nZOWYWEK4Hs6R8MBTIwpdKBrPQL nxGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765224291; x=1765829091; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=d9WaSQQ0PkGqeHp9LL2kJRaAe2H4lpRnuEoZ98r23rw=; b=JhLwBaNOLwjVUlmRHwaUbPiHji8eCaUdNsxFvSvgfjpPsSAzKe3PVtT+f3vJEjCULl puGhgtQOXbWIhZO2UrAEgH3nxVFaDwQw/auwsYVm7q7T6BEoUSkSUVznhR3l/TD2spsc tkCQMjfryhuCsutBuD70T0nA8NNDkO7/4U+ai932V5TzkRSgEY4jj2/j2Hv+IlxJjluB stKZ4JGqqcxq4Caie4PrQAM38741oFNEXdN9WlKRAlpj5w6yyNHop2kgRL9vgsm0yZVQ Wc77Q258EN6AexStO7MJdV5chpPWvYGCPWaKmh7dOE5eVDwePsf1I4U3URCbImqPxDPx J+ww== X-Forwarded-Encrypted: i=1; AJvYcCXVplm3p4mi6m21jdXIUhpZlQhf24eZt+DSRTr6KjUCYMrSajfp06MKyokF18DDTtyEc1ka2E6Wmr8SQts=@vger.kernel.org X-Gm-Message-State: AOJu0Yznz0BuwEV1amrum2zu2ZyCv/h9tSk6xr9Y+edg/R7yNarppBdt mvp6NInCBx3c5Yad+7PrvwU0fHPmaHNFTx+EV+DryN7daHP1rNNH4l41 X-Gm-Gg: ASbGnctzXbgvi24auUKz6PBivp+PJkM9fOt2d796MbOhZtrZLp9klkdleFmcvzqzgCj lDh8JwH7vSBx4JhP3twC4K/gXzCuB97swOQj5Cm+0mlqmBMS29fJg08ZQK8tn8osIzygHFAu9R/ 1t4fvmh8epHpPEWquLA8gvitARMnZHMjnFklEamJq0QS2DF4/z6ah6aLXDC6DUQ9jksGFmBM8Zg YuggJSnM3Dpb/SEX05Bf+md5HxJBh4Y7fWj7LPT6nOjZ+HXh8M3+zp76RgGAWkYVrA9Yx67xe7V +BJ+rN/V1QETxrVt5KNNWpOpEkdXu1Ae7lkrTgLWfWVpeYip1ws+n2cYH8HqZUfoLmmE0BX7Bxs pjDu1IOdj7QfNSmhosS8GhT/ZHsQCjCUDnEGS67CuKlNYIlz8LK/YlGKsUIdPHuIEn5B61oc0ls 5bf95l+0aVIWQDKgB2jOUHZnCDAJAQFf9MgiL4its6TuWgcpuidEg= X-Google-Smtp-Source: AGHT+IELJ4QWyLI18G+CslWw8CT4fzH53HDJS5AGtq1akWXecKkPf5nz0AOnRqyw1ggDtLTR6UltQg== X-Received: by 2002:a05:600c:3b8b:b0:477:af07:dd17 with SMTP id 5b1f17b1804b1-47939e3897cmr134757755e9.24.1765224290994; Mon, 08 Dec 2025 12:04:50 -0800 (PST) Received: from Ansuel-XPS24 (93-34-88-81.ip49.fastwebnet.it. [93.34.88.81]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-47a7d6eb1f1sm1906885e9.2.2025.12.08.12.04.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Dec 2025 12:04:50 -0800 (PST) From: Christian Marangi To: Jeff Johnson , Vasanthakumar Thiagarajan , "Rob Herring (Arm)" , linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Christian Marangi , stable@vger.kernel.org, =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [net PATCH] wifi: ath11k: fix wrong usage of resource_size() causing firmware panic Date: Mon, 8 Dec 2025 21:04:32 +0100 Message-ID: <20251208200437.14199-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On converting to the of_reserved_mem_region_to_resource() helper with commit 900730dc4705 ("wifi: ath: Use of_reserved_mem_region_to_resource() for "memory-region"") a logic error was introduced in the ath11k_core_coldboot_cal_support() if condition. The original code checked for hremote_node presence and skipped ath11k_core_coldboot_cal_support() in the other switch case but now everything is driven entirely on the values of the resource struct. resource_size() (in this case) is wrongly assumed to return a size of zero if the passed resource struct is init to zero. This is not the case as a resource struct should be always init with correct values (or at best set the end value to -1 to signal it's not configured) (the return value of resource_size() for a resource struct with start and end set to zero is 1) On top of this, using resource_size() to check if a resource struct is initialized or not is generally wrong and other measure should be used instead. To better handle this, use the DEFINE_RES macro to initialize the resource struct and set the IORESOURCE_UNSET flag by default. Replace the resource_size() check with checking for the resource struct flags and check if it's IORESOURCE_UNSET. This change effectively restore the original logic and restore correct loading of the ath11k firmware (restoring correct functionality of Wi-Fi) Cc: stable@vger.kernel.org Fixes: 900730dc4705 ("wifi: ath: Use of_reserved_mem_region_to_resource() for "memory-region"") Link: https://lore.kernel.org/all/20251207215359.28895-1-ansuelsmth@gmail.com/T/#m990492684913c5a158ff0e5fc90697d8ad95351b Cc: Ilpo Järvinen Signed-off-by: Christian Marangi --- drivers/net/wireless/ath/ath11k/qmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c index ff6a97e328b8..afa663c00620 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c @@ -2039,8 +2039,8 @@ static int ath11k_qmi_alloc_target_mem_chunk(struct ath11k_base *ab) static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab) { + struct resource res = DEFINE_RES(0, 0, IORESOURCE_UNSET); struct device *dev = ab->dev; - struct resource res = {}; u32 host_ddr_sz; int i, idx, ret; @@ -2086,7 +2086,7 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab) } if (ath11k_core_coldboot_cal_support(ab)) { - if (resource_size(&res)) { + if (res.flags != IORESOURCE_UNSET) { ab->qmi.target_mem[idx].paddr = res.start + host_ddr_sz; ab->qmi.target_mem[idx].iaddr = -- 2.51.0