[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230127111605.25958-31-srinivas.kandagatla@linaro.org>
Date: Fri, 27 Jan 2023 11:15:58 +0000
From: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
To: gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org,
Rafał Miłecki <rafal@...ecki.pl>,
Michael Walle <michael@...le.cc>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Subject: [PATCH 30/37] nvmem: core: fix nvmem_layout_get_match_data()
From: Rafał Miłecki <rafal@...ecki.pl>
This function was trying to match wrong OF node (parent device's)
against an of_match_table. It was always returning NULL.
Make it match layout's OF node against layout's of_match_table.
Note: __maybe_unused is needed to avoid:
warning: variable 'layout_np' set but not used [-Wunused-but-set-variable]
(of_match_node() is no-op without CONFIG_OF).
Fixes: f61a093b4a0e ("nvmem: core: introduce NVMEM layouts")
Signed-off-by: Rafał Miłecki <rafal@...ecki.pl>
Reviewed-by: Michael Walle <michael@...le.cc>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
---
drivers/nvmem/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 30057b0094a2..38a5728bc65c 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -824,9 +824,11 @@ EXPORT_SYMBOL_GPL(of_nvmem_layout_get_container);
const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem,
struct nvmem_layout *layout)
{
+ struct device_node __maybe_unused *layout_np;
const struct of_device_id *match;
- match = of_match_node(layout->of_match_table, nvmem->dev.of_node);
+ layout_np = of_nvmem_layout_get_container(nvmem);
+ match = of_match_node(layout->of_match_table, layout_np);
return match ? match->data : NULL;
}
--
2.25.1
Powered by blists - more mailing lists