From nobody Mon Feb 9 16:33:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C024C001B0 for ; Tue, 8 Aug 2023 17:42:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232837AbjHHRmc (ORCPT ); Tue, 8 Aug 2023 13:42:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234036AbjHHRls (ORCPT ); Tue, 8 Aug 2023 13:41:48 -0400 Received: from mslow1.mail.gandi.net (mslow1.mail.gandi.net [217.70.178.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D62F238FE for ; Tue, 8 Aug 2023 09:18:29 -0700 (PDT) Received: from relay1-d.mail.gandi.net (unknown [IPv6:2001:4b98:dc4:8::221]) by mslow1.mail.gandi.net (Postfix) with ESMTP id 6409AD2EC1 for ; Tue, 8 Aug 2023 06:29:55 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id CAD39240007; Tue, 8 Aug 2023 06:29:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1691476178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bS+vOtPyOkEkdV/nhm5MLbH36mndj+2cFLrBIoA8aFE=; b=hmZdhcJMLGN3+DbMpvMXzXuhrzlVj07IbxZyeePTN2JyLD/a4NiUtN4gIhsGaxBb2XmDnX lDvW/O/OeoxxLFtu2Ox/AtXUf8XDhli58FiYcE9/ABE6BSDCTuyYUVsA9HAGkd3pXqZlda jV5gb4hz3TBCnvpWHyErNG19MG20VyuvdHWEWfj4VKquO10teScjrO00EADRIUS0GAQ/Gc +xEOe/SdIFXUJRHoKtwZvauUmU0RQlzxRYZxg4Vzg1Npwzma1Nq6rnJy4LFreEpdjiCCVH RFc3JzffgR4WyC5JzOFJWXeIyGAwHqsIfwXo9xw5iyRm5unlW59VQRtlL0otFw== From: Miquel Raynal To: Srinivas Kandagatla Cc: Greg Kroah-Hartman , Thomas Petazzoni , Robert Marko , Luka Perkov , Michael Walle , , Randy Dunlap , Chen-Yu Tsai , Daniel Golle , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Miquel Raynal , kernel test robot , Dan Carpenter Subject: [PATCH v9 2/7] nvmem: core: Return NULL when no nvmem layout is found Date: Tue, 8 Aug 2023 08:29:27 +0200 Message-Id: <20230808062932.150588-3-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808062932.150588-1-miquel.raynal@bootlin.com> References: <20230808062932.150588-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: miquel.raynal@bootlin.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Currently, of_nvmem_layout_get_container() returns NULL on error, or an error pointer if either CONFIG_NVMEM or CONFIG_OF is turned off. We should likely avoid this kind of mix for two reasons: to clarify the intend and anyway fix the !CONFIG_OF which will likely always if we use this helper somewhere else. Let's just return NULL when no layout is found, we don't need an error value here. Link: https://staticthinking.wordpress.com/2022/08/01/mixing-error-pointers= -and-null/ Fixes: 266570f496b9 ("nvmem: core: introduce NVMEM layouts") Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202308030002.DnSFOrMB-lkp@intel.com/ Signed-off-by: Miquel Raynal Reviewed-by: Michael Walle --- Backports to stable kernels is likely not needed as I believe the error pointer will be discarded "magically" by the of/ code. --- include/linux/nvmem-consumer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index fa030d93b768..27373024856d 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -256,7 +256,7 @@ static inline struct nvmem_device *of_nvmem_device_get(= struct device_node *np, static inline struct device_node * of_nvmem_layout_get_container(struct nvmem_device *nvmem) { - return ERR_PTR(-EOPNOTSUPP); + return NULL; } #endif /* CONFIG_NVMEM && CONFIG_OF */ =20 --=20 2.34.1