From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (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 1115940B6C2 for ; Tue, 5 May 2026 07:02:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777964522; cv=none; b=Pv54aOwCXXBPMNJFh1yXL+gBS2Z7VSo8bYi/1UAwWELfuuBoBGH4UohKwDL+z3kTu5eUZWspH3AXu0oECLbE6vu2iT1OburoHGr5xStK1jC5p48AtL5iXITi6m9OGDTCcLR0cbLCkMkvVyQT1bk3kG4VUOpayCzGTK9Ss3iCFcU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777964522; c=relaxed/simple; bh=atpocCViVZpUvDy5Jq4P7at3QeU4Hvp6bppgvQ2BWM8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RZV/qcFjOvwPJB4ZRRu+65ljGfUejvpsCQJ1D9p/E9lOWSpdYSTkJ9rgEVGj6t6bghEA5pr+n2xOHiJAnZnvVlZ5qzfPykbO+jGBl7ArzjzRtvD3VI06qIKxueAWLNJvN0iFjhS5V8rQmdM1tW3pJYukEaZPcYRUD0io5y745vg= 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=GWJ7kkWZ; arc=none smtp.client-ip=209.85.208.48 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="GWJ7kkWZ" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-67b32c695efso7727055a12.1 for ; Tue, 05 May 2026 00:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777964519; x=1778569319; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=sJoGeOymzDzt4BduT12fzk90tICGYXHSXGced9NaYww=; b=GWJ7kkWZA2Zjn11QZC9RrrRKqySJfrW5pQJQO9uMwhMzyc2vUNZ7L2LMmbUvIML1B7 X9SQnNZe2oopfQEdhU3bai0KD4VYqmo2JKarc7Cdyfjgbb/nls0pvtoK7EYD3BeFz/Gt jQrBxaCJAzkjLcn8EowRgOAN8PzbZ6ITLVwKZcTFc0dMXf6kKcsgeAulhWnis7rhIO0n 7DBeiYros1ifzz7nVvaZTtkoCyO8AjTdHxUEZWYVcAjF0swoZADL6O8J5t0XDo3eMGnv c/+jP81XqgFCq2LbqQJMFWTMz2hUiy2LULSTP4vnOu+DNViJHHlOMif6/kyq8mp7MDyj 79vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777964519; x=1778569319; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sJoGeOymzDzt4BduT12fzk90tICGYXHSXGced9NaYww=; b=n/lCNDuKSCAfrpfDfJBDyxnw5vyX9MzEtkOMjQCQUh2xIhTarOxOQ98ERvK1+e+dVu XuJWJU9GEcCs6tr23Wj4ZajFqQcRYfSK/grzydJZODR3ErQGAR+u4sDSv/hjZlMB8Ij6 +tKVG48JH4nMrxZ842Pa2vgvLOSUdw6iKIhlLdy7hZI8uEcIvsG2OT0tTDZeHsc3yqLZ rYqOvnOSqPPBcwg5cewepDjrz+JOFHcuNA1AuqqPAJmV0E5J8RGaX+D1hS0HJ2nP01mK Xo6nDxLY4m07ei/5DyWKShbg8tOYjT5QaxPfk/7x7DRePECq5BFG+bUEhqbB+RO1vJgY B+5g== X-Forwarded-Encrypted: i=1; AFNElJ9IqKa/OIo9SiXzJPRMFpPW5fFHOpwupBBFVIIvz2fZ5VFFI93L0IMtHf+6SvcCCrhuQx3/sNhFTATxiZI=@vger.kernel.org X-Gm-Message-State: AOJu0YzfjjxLA7GdMLMa5QC/+mRDrXaftMUUuEuiVJTNAkf0gp8pHdOR Qhwyuviqj0njBPKaKswW4hQkrECue9mo1Q8AbQsXfvowAunZFn77utd6 X-Gm-Gg: AeBDiesS5YZRg9qD0vWV6JMxqerq08kTY3NqcSIHjb3Uomoitu4YEnAM3BUdAGYAtr1 srsqAzEFBONWCPjdmOBX6u0axGMegTbTGBLxzqCSArYjdPA9xJhYnd80mdh3/tHJRPFeVb0NvoX HUlQ7TmM0+3HEF5Towg0b0Q8xXu+X+HM+k3U7BePyyUsG8pAC2LiQDEBGoFNDidhzhAmmhmY5cU linIOGHqKn/fRg5NWL5zSaNde3FhQFzr8GOf9DDG47pMhhqPOH4kxbNoISCz1FZzfMXViD9nfLB 1suTVZ3edVovMBdd1O+/UGYTy0sxohmoxMmZI11DDPWuDzlls3ZDrEQDDDiunxkQmwm1ILqC/+/ WG2nseWbz2l0TrCTs0sqkg2kt+O5KUAjC0QAPu3iLkLAzBEb5mgmiUOBR7I4gUnIElXP+//VGIc 4dl5Mq+/VMEbF9FTHqqdD3ci8= X-Received: by 2002:a17:907:e849:b0:ba3:961e:d5e4 with SMTP id a640c23a62f3a-bc3d0652a8bmr153046066b.1.1777964518946; Tue, 05 May 2026 00:01:58 -0700 (PDT) Received: from pc ([196.235.252.38]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-bc20825b337sm188510066b.23.2026.05.05.00.01.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2026 00:01:58 -0700 (PDT) Date: Tue, 5 May 2026 08:01:55 +0100 From: Salah Triki To: Jonathan Cameron Cc: Andy Shevchenko , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iio: temperature: tsys01: fix broken PROM checksum validation Message-ID: References: <20260428152239.66213-1-salah.triki@gmail.com> <20260429103304.654ed9a0@jic23-huawei> 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=us-ascii Content-Disposition: inline In-Reply-To: <20260429103304.654ed9a0@jic23-huawei> On Wed, Apr 29, 2026 at 10:33:04AM +0100, Jonathan Cameron wrote: > On Tue, 28 Apr 2026 18:49:56 +0300 > Andy Shevchenko wrote: > > > On Tue, Apr 28, 2026 at 04:22:39PM +0100, Salah Triki wrote: > > > The CRC check function was incorrectly using only the first word of the > > > PROM (n_prom[0]) instead of iterating through all words. This caused > > > the driver to fail probing on most devices due to incorrect checksum > > > calculation. > > > > > > - Fix loop to use the correct index n_prom[cnt]. > > > - Ensure all bytes are summed as per the datasheet specification. > > > > ... > > > > > u8 sum = 0; > > > > > > for (cnt = 0; cnt < TSYS01_PROM_WORDS_NB; cnt++) > > > - sum += ((n_prom[0] >> 8) + (n_prom[0] & 0xFF)); > > > + sum += ((n_prom[cnt] >> 8) + (n_prom[cnt] & 0xFF)); > > > > > > return (sum == 0); > > > > This change makes more questions than answers. How had it been tested, > > if tested at all? (This question is to before and to after, the commit > > message is also unclear about what datasheet says or the real field > > testing gives.) > > > I'll guess first word of the PROM is typically 0? > > The datasheet indicates that it exists but then says absolutely nothing > about what is in that word - unlike all the others that are documented. > > To me the fix looks right (based on the datasheet) but absolutely this > patch description should make that clear if this isn't tested on hardware. > > > Thank you for looking into this and for your clarification. Indeed, the code audit reveals that the loop index is ignored, causing the driver to process only the first word repeatedly. I will send a v2 with a more detailed commit message explaining that this fix relies on the datasheet analysis rather than physical hardware testing. Best regards, -- Salah Triki