From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B41F141D65E; Thu, 6 Aug 2026 08:47:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006057; cv=none; b=AxyOnoCc6mXHT2tz5SumXgj3N7rrSpZFxZnHutVHfPL2Wsvsm66MJjBL+JlitJBHjymULRVGn0ziV7NoHs6/lqw3ua4HdcUbYEcm1OdndC0sPXEPwhsF7Tua/302CfeP2rX3OxE4VmSaIdEVOfBztXCiVS6Fho3r9GfNK4nZYfk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006057; c=relaxed/simple; bh=HAGc0aQvGQ6xckPzuGtbesPxW4BhT95FbIaJJrF46dg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bGESwqcVrSLc3oa0eU1rYJJwTMkMaHOTvNq9kt4V6zdN0ONrNg2mHlT9GXNct8iqtt2iVxMeedRLMCvS8c97cAycqCTQfbDWHQoXAtqFagGjyNAOV28Q93Sbv/Rdtxeh0shPm6E816LWEEtY795NvbeZ9sUG/m2NX9Wn5cf79Wo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=gFbV6f2y; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="gFbV6f2y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006055; x=1817542055; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=HAGc0aQvGQ6xckPzuGtbesPxW4BhT95FbIaJJrF46dg=; b=gFbV6f2yvWROJ7xP6j/LRVmRVF6o078Jn+/y9YqK1PN0uQYkt+HfHVke ISKccoiJ0zJpMT5KqbkHR5Aa00RYv3AlhLmty+xzcviJa+HW+NO8HPg4z NgB7nuTMvC68HhrPUoqQQWaBnk8WqsQH17+5lj64OWvd7/NK1tmsGOmXj LIPuNkqlOKmuq/ZCgs3bFT/rP7y/otgwP+TE5kYj8NbaLEguvyC1/eKiE Lyq8AhGpQO33ciMz0858pUXUUgRPizszdq6pMpqAJvr+v+Vl8ar/u43ol I/igfyuktgGOLxZavRWVWjrifXIC2S17q5DzeRvr1W78zAPVGny3T7iiX g==; X-CSE-ConnectionGUID: wnHrijeJRjKZik9IHqX1Ig== X-CSE-MsgGUID: Hy9L2xaLT8mnDkh/AMrrlQ== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="228880366" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2026 01:47:34 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.87.152) by chn-vm-ex4.mchp-main.com (10.10.87.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.45; Thu, 6 Aug 2026 01:47:34 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:47:25 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 05/17] iio: adc: at91-sama5d2_adc: add condition to validate calibration data Date: Thu, 6 Aug 2026 13:10:12 +0530 Message-ID: <20260806074024.531259-6-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index 82db8f2f4db0..5b21367cf6b4 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -2297,7 +2297,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.34.1