* [PATCH V2] nvmem: core: fix nvmem_layout_get_match_data()
@ 2023-01-10 20:43 Rafał Miłecki
2023-01-20 17:37 ` Srinivas Kandagatla
0 siblings, 1 reply; 2+ messages in thread
From: Rafał Miłecki @ 2023-01-10 20:43 UTC (permalink / raw)
To: Srinivas Kandagatla
Cc: Miquel Raynal, Michael Walle, linux-arm-kernel, linux-kernel,
Rafał Miłecki
From: Rafał Miłecki <rafal@milecki.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: f5709a684a0a ("nvmem: core: introduce NVMEM layouts")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Michael Walle <michael@walle.cc>
---
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 d112bb1328c1..d3be50ed2d0b 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.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH V2] nvmem: core: fix nvmem_layout_get_match_data()
2023-01-10 20:43 [PATCH V2] nvmem: core: fix nvmem_layout_get_match_data() Rafał Miłecki
@ 2023-01-20 17:37 ` Srinivas Kandagatla
0 siblings, 0 replies; 2+ messages in thread
From: Srinivas Kandagatla @ 2023-01-20 17:37 UTC (permalink / raw)
To: Rafał Miłecki
Cc: Miquel Raynal, Michael Walle, linux-arm-kernel, linux-kernel,
Rafał Miłecki
On 10/01/2023 20:43, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.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: f5709a684a0a ("nvmem: core: introduce NVMEM layouts")
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> Reviewed-by: Michael Walle <michael@walle.cc>
Applied thanks,
--srini
> ---
> 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 d112bb1328c1..d3be50ed2d0b 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;
> }
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-20 17:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-10 20:43 [PATCH V2] nvmem: core: fix nvmem_layout_get_match_data() Rafał Miłecki
2023-01-20 17:37 ` Srinivas Kandagatla
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).