From nobody Mon Feb 9 11:30:09 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 4E8B4C001B0 for ; Mon, 7 Aug 2023 08:24:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231183AbjHGIYa (ORCPT ); Mon, 7 Aug 2023 04:24:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230415AbjHGIY1 (ORCPT ); Mon, 7 Aug 2023 04:24:27 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0A5A10EF for ; Mon, 7 Aug 2023 01:24:25 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 0A4D8E0006; Mon, 7 Aug 2023 08:24:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1691396664; 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=h9ITThFrDAL4gw+CgsF85+DiojEI16eg8zukQy7IymB5qM5FbBKLO6ipVnaRE6SacEkjhR 7L5nvgEVIMngiuqj/R8yhL2FvmRtjUJnhhYZfLNxW+991cKBuKouJdVzRP1qABsEAgC+56 kfcX22kxvOX2XfiHYyEi5tHD4QzMsbGm9szl+2N/eau5vaDcv9xD/th32j7JuWEfzJrZ1J ZvXqBfnkzJczCDU6Qc8zrnVeaDDvmugqDscjpfUUQGKESVtse+EkpWp+noLVd8woI39s8b K2kZLQh7PjdPV9Uw98gWvYnAGFsQmefUbD6gnompMMStJg+FTKDL7WpoD3SrGg== 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 v8 2/8] nvmem: core: Return NULL when no nvmem layout is found Date: Mon, 7 Aug 2023 10:24:13 +0200 Message-Id: <20230807082419.38780-3-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230807082419.38780-1-miquel.raynal@bootlin.com> References: <20230807082419.38780-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 --- 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