Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2692962lqp; Mon, 25 Mar 2024 06:52:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVinniN1hPT47do1kD/W5K9j0zwdS08TBngVteZG1OC1kYvbr0dLNn5tlmxspBHqk2XUhWDxTxKjZ76R3I9uBgWAaG9Eau1ThbzLcH6zw== X-Google-Smtp-Source: AGHT+IG0KHUJ98zUUkBy5DMrKnHuS1izCE/LNEY9XWMQ7sDMSP0armT4cPgOWUWhalrFua+dUBJA X-Received: by 2002:a05:6a00:a8c:b0:6ea:ad5e:54fb with SMTP id b12-20020a056a000a8c00b006eaad5e54fbmr2740527pfl.12.1711374760174; Mon, 25 Mar 2024 06:52:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711374760; cv=pass; d=google.com; s=arc-20160816; b=dCY4MqLbYM5u2lbBOgcOdD+NYESGh7nAZO6tUEYgexV++mZ4BwoiXl6k6jP5ygoFUF Io7SjAVQN65++pOePOWwKKH7btnr1A3gPhejfVaDsUly2R8m9//fxoChZfpcR1yOtnc6 k7Fgjn8b3zEIUG0wYo048sEks01Q3i1h1y/0jkzqFbvwW+fJtBDEg3m4KRXPz9zozicI 1l7gyli4fzkPq/Qmzp67bzaKBbGa02NKafsqsGUdK+d5plO6qj+K67/YvwPF+yGLdhAE kl98RhMllS1IqDtebhua2aiSR6c/54BqBF4q4wWL8gdXoeJMXBz4M98KTgWzcjdn7SHG Bfjg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date:dkim-signature; bh=g7SMZhAf4Am0rTnm/eARUporpv8JgZVnopqWzBN3xYo=; fh=lQc5X3XzaZrVI497Gzo3dkDCNGGVVJxhXj568uakTE0=; b=qGvmSFqs3iyy6Oi9mI49JEq1GBr4y66sr7NuAKrLe4HHu+0+JgrJeQxbLIxTW+Mql2 9NuGDlWL0h3fbifCYdILR6Dj7gTYTOJYaAkygh6q4/Wlcgn4OH3Gevl9X7qbdOng+65c S44m89wAuUrFJBbD6svUTxLI2LjAF4IgyIYLMN4KdmWHwKR/eruQmFdJ1WmsOJurr2SO WWbh1K865wYO7RiNR+aM9tu2AwqU0riNmfKMAYCgg7mUWu3WvhkFDfjpHZlyu+ZmDMBs qoCdCydk2UaTA56duPAY7/DYinPH3wg21wpwJ9RcRrccjCzs23T8zhzWSaE8MdGsUfsA MYCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=enHZmhgK; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-116737-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116737-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id i17-20020aa78d91000000b006eab33c57edsi489121pfr.302.2024.03.25.06.52.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 06:52:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116737-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=enHZmhgK; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-116737-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116737-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BBD852E13F4 for ; Mon, 25 Mar 2024 13:52:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7FDCE1422CE; Mon, 25 Mar 2024 10:33:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="enHZmhgK" Received: from mslow1.mail.gandi.net (mslow1.mail.gandi.net [217.70.178.240]) (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 A57DF170A3F for ; Mon, 25 Mar 2024 09:09:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.178.240 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711357777; cv=none; b=gJZpWbRdEIFFQLF/sNicDAQ4d7Uyrq1aoM4ltu3vTelj85AoVRljKdZNyp/HJxgKPRzvOfL+g2ItmpKMbk12OvGdK+j4ZO0hfPnXcQdyxsJVWocvAbKtkxpYKtiWhuKy0jWBFbzlpG44gCn34mTdUp6Fio0o2KTgBm0OIItKLNA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711357777; c=relaxed/simple; bh=myK+VAmTaTPxdQF4/X8FLBK790KZzA6ht2Keg01FX9c=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=L4q9jueYfuBFORlJ4XVRE481dLaT56zC7DlI8xHKpjk0og0qdvbO14ki9qAIyyd+YTqknhPNYPGIZftoZVjjVW/mrAz+Q8FCIL8iebQfiRiEvRBBCgAG55/08nZdt1ghGfivrDT3lBcpW6qzr13QytcrHj0+OIZtyx+c4jLk9Yk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=enHZmhgK; arc=none smtp.client-ip=217.70.178.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: from relay3-d.mail.gandi.net (unknown [217.70.183.195]) by mslow1.mail.gandi.net (Postfix) with ESMTP id E80C7C5444 for ; Mon, 25 Mar 2024 09:09:26 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 0770E6000C; Mon, 25 Mar 2024 09:09:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1711357759; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g7SMZhAf4Am0rTnm/eARUporpv8JgZVnopqWzBN3xYo=; b=enHZmhgK7R2eEv2n80yLDfGotfc2qlr6jstwvnMzsZFNaSDo2gaooBLPB2v/FyK+o4h0m1 cEgWXNpRUW3UWMFUzE0GcWPhuc2m4hGwUrViLbf8l9jLlrLOUiO6SBpEBtbzPgB6z2yoZB 7zR5b0hQQhhCZ39hqL4yLow+YFQ546UeIsdwi1vA4++SOAfGe9uesYToBfwqG0G7rL8kg5 ZmaopkO3vG99dpOiw45LCOfJMzmB+hkb97DOi7OfwAXrMsay0OtSmi4pUk29OBOshgcA2U mqhZRUdvyho23ubWuD3o7WzcLT5mO5xmCrw9K5VtZO4Eky11/HA1k7XfQbgAgA== Date: Mon, 25 Mar 2024 10:09:16 +0100 From: Miquel Raynal To: Alexander Dahl Cc: linux-mtd@lists.infradead.org, Richard Weinberger , Vignesh Raghavendra , linux-kernel@vger.kernel.org Subject: Re: mtd: nand: raw: Possible bug in nand_onfi_detect()? Message-ID: <20240325100917.502c75b7@xps-13> In-Reply-To: <20240307181931.440c9c3f@xps-13> References: <20240306-shaky-bunion-d28b65ea97d7@thorsis.com> <20240306164831.29eed907@xps-13> <20240307-pantry-deceit-78ce20f47899@thorsis.com> <20240307181931.440c9c3f@xps-13> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) 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: quoted-printable X-GND-Sasl: miquel.raynal@bootlin.com Hello Alexander, > > > > The condition is true and nand_change_read_column_op() returns with > > > > -EINVAL, because mtd->writesize and mtd->oobsize are not set yet in > > > > that code path. Those are probably initialized later, maybe with > > > > parameters read from that ONFI param page? > > > >=20 > > > > Returning with error from nand_change_read_column_op() leads to > > > > jumping out of nand_onfi_detect() early, and no ONFI param page is > > > > evaluated at all, although the second or third page could be intact. > > > >=20 > > > > I guess this would also fail with any other reason for not matching > > > > CRCs in the first page, but I have not faulty NAND flash chip to > > > > confirm that. =20 > > >=20 > > > Thanks for the whole report, it is interesting and should lead to fix= es: > > > - why does the controller refuses the datain op? =20 > >=20 > > See above. > > =20 > > > - why nand_soft_waitrdy is not enough? =20 > >=20 > > I don't know. That's one reason I asked here. > > =20 > > > - changing the condition in nand_change_read_column_op() > > >=20 > > > Can you take care of these? =20 Now would be a perfect time to send these fixes. Could you work on them? Thanks! Miqu=C3=A8l