Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp78089lqh; Wed, 27 Mar 2024 15:33:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWJVz4gZBNpVNX/T+i+YyXW06ASBz6EkHZ37YQLYwC31boXRwZsTUtqqd06bt8xuIl+FEqJlPBbu2NS3v0DviwP2qqTWqFuvntmQ6lLCg== X-Google-Smtp-Source: AGHT+IEhu0DVyGa3jJO4zPbVUiWVklyb5Izlts/l6G+SZcBQVBoH0MZ7shLOLIyhbKiM4HrYezgL X-Received: by 2002:a05:6214:5604:b0:690:b3a3:2261 with SMTP id mg4-20020a056214560400b00690b3a32261mr936193qvb.53.1711578805898; Wed, 27 Mar 2024 15:33:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711578805; cv=pass; d=google.com; s=arc-20160816; b=mjgtMZRyhpza/P9yNIjmlHZel+vc5zDDKiKz/jj3bpNOWTGRktek3CDH4s2z27otka kxZOKGZ1mF5lz+7PdvCKtLyihs0kTuxHYxFVQEgqJz6RWxdK1MSug1K+u1Hh/ZOAh8NU 8fE4oX1JOUV2I3mTdBYZhjGjC4Thhqfr6nIMSJhAniSCZviwUykVt78uRrzCSeR0QNoa yzZbuZdtsYWpZv/ljhNiu2TuQG5cYsi9yTm4CgIyb/Nc6GkLdrsK8ZaQwcN5mj0Lbmu7 MIVPaXSGV/jbHmBJi0EaWOV2nrHjE5T0YcVUUr3VwcBYDin0usD1qzadKGD901GtQlbz Mo+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=h5PsATGCDFL2J2cI/GPKAGA2Y6JiayI+4OKOPjmqM1Y=; fh=tN9q8lQBMB+G2lQkUvxfFgcCX8zYq1xPgYjA+V3KYkA=; b=ilCxs+x0KFM4FPI38+8fhgVhU/3+Ec+rW6Gc1VRmM28JqgROO89D2Z0RZQqFJxw4rN lI4QPYva+y9kHOt72728Q/c3nfD9+XhA1nyx7rOAMzt3PwLUFDBkF7KgbOLO74jA3QEa eaObpAlVkX2Ufg+zaZXvrfgR0fwXnkVEZA6JfF/V76bSGO4CHPMMMsBn22QT9hHKNEZC cOWlA98o4vBY7JVWHcwirS+c/yYYO7eI6IxtWeabK4Tsgg+ge3a2Inft6RD6ycY20nJb rMnKU7NMWcAKs38yKzw406W4rltOoufCCBQMbvf086ymoPgG1hmJXF+MsD+IFPuXE5zo gqZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=milecki.pl); spf=pass (google.com: domain of linux-kernel+bounces-122104-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122104-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k11-20020a0cf28b000000b0069673f5e467si148438qvl.102.2024.03.27.15.33.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 15:33:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-122104-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=milecki.pl); spf=pass (google.com: domain of linux-kernel+bounces-122104-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122104-linux.lists.archive=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A0C071C2FA6D for ; Wed, 27 Mar 2024 22:33:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A59981EB40; Wed, 27 Mar 2024 22:33:20 +0000 (UTC) Received: from 2.mo560.mail-out.ovh.net (2.mo560.mail-out.ovh.net [188.165.53.149]) (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 3E0932376A for ; Wed, 27 Mar 2024 22:33:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.165.53.149 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711578800; cv=none; b=cy+GARi5Mww0LMApk44CAiL4LS4h1djFU4B1/Bsl6xI2yJ13sXiqtJqazxI+quVIl9yJE/XOhwrSXu41R/6YSq91ghYHOc56vijdvS6uC3NlSmoqFFr6MPSMJ1/HDdQBEGaKhFgdYDwWrhsqFiq3K8WyN+H1VmZ2XjxGMPF6/e4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711578800; c=relaxed/simple; bh=uubMJfEGsx1wHMfNv8O85cjpX0Z4oxTc9ge4GrdhcKE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=O3qVHDR52x3cNqCevnhfZjJHePaqsQSQNoI9T3otS0UD7rimozn59lDOy8V2nk82q/U2IowM7qBdwCw6KIbxQrq1QOGaDrrnS/l8sj1Ues/zgHhTrrX2RsJOogV79EW7WDEJQNBE9GyhRVl+9rw9GlJrC0yVrgx7h60u8xc9zRE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=milecki.pl; spf=pass smtp.mailfrom=milecki.pl; arc=none smtp.client-ip=188.165.53.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=milecki.pl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=milecki.pl Received: from director9.ghost.mail-out.ovh.net (unknown [10.109.176.162]) by mo560.mail-out.ovh.net (Postfix) with ESMTP id 4V4gvv0d45z1JMc for ; Wed, 27 Mar 2024 22:15:07 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-xfkn4 (unknown [10.110.178.52]) by director9.ghost.mail-out.ovh.net (Postfix) with ESMTPS id E1CF91FD2C; Wed, 27 Mar 2024 22:15:03 +0000 (UTC) Received: from milecki.pl ([37.59.142.107]) by ghost-submission-6684bf9d7b-xfkn4 with ESMTPSA id gjE7MWeaBGY6QxIAbVqslg (envelope-from ); Wed, 27 Mar 2024 22:15:03 +0000 Authentication-Results:garm.ovh; auth=pass (GARM-107S0012491a7f4-335c-4194-8bbd-5f1ada98fd90, AD8588E3BB83D84E59DEA8CE8674EAB20989D6B2) smtp.auth=rafal@milecki.pl X-OVh-ClientIp:31.11.218.106 Message-ID: <30bc0d38-b610-4397-ba42-46819d5507fc@milecki.pl> Date: Wed, 27 Mar 2024 23:15:02 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] mtd: limit OTP NVMEM Cell parse to non Nand devices Content-Language: en-US To: Christian Marangi , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Jernej Skrabec , Claudiu Beznea , Greg Kroah-Hartman , Srinivas Kandagatla , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org References: <20240322040951.16680-1-ansuelsmth@gmail.com> From: =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= In-Reply-To: <20240322040951.16680-1-ansuelsmth@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Ovh-Tracer-Id: 11126987304968301369 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrudduiedgudefgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomheptfgrfhgrlhcuofhilhgvtghkihcuoehrrghfrghlsehmihhlvggtkhhirdhplheqnecuggftrfgrthhtvghrnhepgeekvdfgleeuteeludfghfduvdffjeekhfehteefvefggeelheeludeuiedvueejnecukfhppeduvdejrddtrddtrddupdefuddruddurddvudekrddutdeipdefjedrheelrddugedvrddutdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehrrghfrghlsehmihhlvggtkhhirdhplhdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheeitddpmhhouggvpehsmhhtphhouhht On 22.03.2024 05:09, Christian Marangi wrote: > diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c > index 5887feb347a4..0de87bc63840 100644 > --- a/drivers/mtd/mtdcore.c > +++ b/drivers/mtd/mtdcore.c > @@ -900,7 +900,7 @@ static struct nvmem_device *mtd_otp_nvmem_register(struct mtd_info *mtd, > config.name = compatible; > config.id = NVMEM_DEVID_AUTO; > config.owner = THIS_MODULE; > - config.add_legacy_fixed_of_cells = true; > + config.add_legacy_fixed_of_cells = !mtd_type_is_nand(mtd); > config.type = NVMEM_TYPE_OTP; > config.root_only = true; > config.ignore_wp = true; I think there may be even more unwanted behaviour here. If mtd_otp_nvmem_register() fails to find node with "user-otp" / "factory-otp" compatible then it sets "config.of_node" to NULL but that means NVMEM core still looks for NVMEM cells in device's "of_node". I believe we should not look for OTP NVMEM cells out of the "user-otp" / "factory-otp" compatible nodes. So maybe what we need in the first place is just: config.add_legacy_fixed_of_cells = !!np; ? Any extra limitation of .add_legacy_fixed_of_cells should probably be used only if we want to prevent new users of the legacy syntax. The problem is that mtd.yaml binding allowed "user-otp" and "factory-otp" with old syntax cells. It means every MTD device was allowed to have them. No in-kernel DTS even used "user-otp" or "factory-otp" with NVMEM legacy cells but I'm not sure about downstream DTS files. Ideally we would do config.add_legacy_fixed_of_cells = false; but that could break compatibility with some downstream DTS files.