From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94808606A31A for ; Wed, 2 Dec 2026 07:33:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=QLl1CHXh; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=yTrinO2P DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=3wUfbiRsyUhX63Tk7S9W8oLk7WNsI0k0X+uresJbCuY=; b=QLl1CHXhpJZTnWIlDm6/L+dVYl Z/D/gsiXU2q4JjlnrcGihIp7vqSVQaYlMf7L3F622hh1yOo3NZN1VFQImudwA0o4NRpZXQ0KwaZMe kD7ivVmO37li31GZx117nmEKnfrlScBvJvl1x/Ib7fdIyPccMV7wq9NPKsEL8jD6YoZTCTb4Yv33F lsVoa6dA2Qnp/u1jHXzBI+uW6F/VXZPHjuG1K0vHeo63h1SPW7DMqHQgOUIVRb8NP6EjaibYCr9Jm 8GVQ00WZRyVEHUUk80swHzx4CZWD+1zlLoDugyWWOwApCzLmjp90iatLDmKnxzC/j6LeBCSl7yIJb 2iPXVN+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYeqN-0000000AWdp-0NR2; Wed, 02 Dec 2026 07:33:35 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYeqJ-0000000AWYk-1QHQ for linux-arm-kernel@lists.infradead.org; Wed, 02 Dec 2026 07:33:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1796196811; x=1827732811; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+ARe9LooocXp6IWkFnhiEDtGm1oUQvXnb7TS5rkTzaI=; b=yTrinO2PrtFu0dk3noWkMmjRFKtHgaMfUeA4UWNvCKXf4YRMND4GYi29 RhAWpfG6AfX57/dz3AZsCJj/8f5q02Y5d1+xfu79zF0tQ5Hm4y8Q8WlvQ sWWkFwwyUYDjlbMft7L1rX+jQyy9/NM3msmlRFxrDDcu3gMIhDsXhGv/p oseGhAJ19jvWWXgKr+w8Y+lWMfQGwCaY+WMoLDgZTzE6Gcln5ulkdGfBs 5oLMH3V1W17h0hdYObO+OPIXOvlRkl3ORE4sXyJzW4mDYcJJn62KffqSG w6e4wIC8ZlkoyBJgysPX+4SGHqroq7D7xa3FcRvdokULG0u3kecUs5Mbm g==; X-CSE-ConnectionGUID: zLZCT/TbRWafS0UhOIiLSQ== X-CSE-MsgGUID: gS+i52vJQDqcz5+RJOFh2w== X-IronPort-AV: E=Sophos;i="6.27,246,1787036400"; d="scan'208";a="78212717" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2026 00:05:40 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.87.151) by chn-vm-ex1.mchp-main.com (10.10.87.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.57; Wed, 2 Dec 2026 00:05:39 -0700 Received: from che-ll-i67070a.microchip.com (10.10.85.11) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Wed, 2 Dec 2026 00:05:34 -0700 From: Varshini Rajendran To: Jonathan Cameron , Srinivas Kandagatla , Claudiu Beznea CC: Eugen Hristev , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , "Nicolas Ferre" , Alexandre Belloni , , , , , Subject: [PATCH v7 06/18] iio: adc: at91-sama5d2_adc: add condition to validate calibration data Date: Wed, 2 Dec 2026 12:34:44 +0530 Message-ID: <20261202070458.87970-7-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261202070458.87970-1-varshini.rajendran@microchip.com> References: <20261202070458.87970-1-varshini.rajendran@microchip.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261201_233331_395258_252DC0FD X-CRM114-Status: GOOD ( 12.27 ) X-Spam-Score: -4.4 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-18.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Add additional condition to validate the calibration data read from the NVMEM cell using the TAG of the packet. Signed-off-by: Varshini Rajendran --- drivers/iio/adc/at91-sama5d2_adc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index 24746a916be5..01132aaf6dca 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -445,6 +445,9 @@ static const struct at91_adc_reg_layout sama7g5_layout = { #define at91_adc_writel(st, reg, val) \ writel_relaxed(val, (st)->base + (st)->soc_info.platform->layout->reg) +/* Temperature calibration tag "ACST" in ASCII */ +#define AT91_TEMP_CALIB_TAG_ACST 0x41435354 + /** * struct at91_adc_temp_calib_layout - temperature calibration packet layout * @tag_idx: index of Packet tag in the NVMEM cell buffer @@ -2297,7 +2300,8 @@ static int at91_adc_temp_sensor_init(struct at91_adc_state *st, return dev_err_probe(dev, PTR_ERR(buf), "Failed to read calibration data!\n"); - if (len < layout->min_len * sizeof(*buf)) { + if (len < layout->min_len * sizeof(*buf) || + buf[layout->tag_idx] != AT91_TEMP_CALIB_TAG_ACST) { dev_err(dev, "Invalid calibration data!\n"); return -EINVAL; } -- 2.43.0