diff mbox series

[RFC,v2,09/20] dm: fix an 'undefined' error in some macros

Message ID 20211210064947.73361-10-takahiro.akashi@linaro.org
State Accepted
Commit 3cfc042d43f5c5cec4bcf0133202bdd8516df66c
Headers show
Series efi_loader: more tightly integrate UEFI disks to driver model | expand

Commit Message

AKASHI Takahiro Dec. 10, 2021, 6:49 a.m. UTC
Due to a non-existing parameter name in macro's, use of those macro's will
cause a compiler error of "undefined reference".
Unfortunately, dm test doesn't fail because a wrong name ("&dev", hence it
is accidentally a valid name in the context of a caller site) is passed on.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Fixes: f262d4ca4b2b ("dm: core: Add a way to read platdata for all
	child devices")
Fixes: 903e83ee8464 ("dm: core: Add a way to iterate through children,
	probing each")
---
 include/dm/device.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Simon Glass Dec. 13, 2021, 12:51 p.m. UTC | #1
On Thu, 9 Dec 2021 at 23:58, AKASHI Takahiro <takahiro.akashi@linaro.org> wrote:
>
> Due to a non-existing parameter name in macro's, use of those macro's will
> cause a compiler error of "undefined reference".
> Unfortunately, dm test doesn't fail because a wrong name ("&dev", hence it
> is accidentally a valid name in the context of a caller site) is passed on.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Fixes: f262d4ca4b2b ("dm: core: Add a way to read platdata for all
>         child devices")
> Fixes: 903e83ee8464 ("dm: core: Add a way to iterate through children,
>         probing each")
> ---
>  include/dm/device.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Ilias Apalodimas Jan. 7, 2022, 12:38 p.m. UTC | #2
On Mon, 13 Dec 2021 at 14:51, Simon Glass <sjg@chromium.org> wrote:
>
> On Thu, 9 Dec 2021 at 23:58, AKASHI Takahiro <takahiro.akashi@linaro.org> wrote:
> >
> > Due to a non-existing parameter name in macro's, use of those macro's will
> > cause a compiler error of "undefined reference".
> > Unfortunately, dm test doesn't fail because a wrong name ("&dev", hence it
> > is accidentally a valid name in the context of a caller site) is passed on.
> >
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > Fixes: f262d4ca4b2b ("dm: core: Add a way to read platdata for all
> >         child devices")
> > Fixes: 903e83ee8464 ("dm: core: Add a way to iterate through children,
> >         probing each")
> > ---
> >  include/dm/device.h | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff mbox series

Patch

diff --git a/include/dm/device.h b/include/dm/device.h
index 3028d002ab0d..f7900417066d 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -959,8 +959,8 @@  static inline bool device_is_on_pci_bus(const struct udevice *dev)
  * @parent: parent device to scan
  */
 #define device_foreach_child_of_to_plat(pos, parent)	\
-	for (int _ret = device_first_child_ofdata_err(parent, &dev); !_ret; \
-	     _ret = device_next_child_ofdata_err(&dev))
+	for (int _ret = device_first_child_ofdata_err(parent, &pos); !_ret; \
+	     _ret = device_next_child_ofdata_err(&pos))
 
 /**
  * device_foreach_child_probe() - iterate through children, probing them
@@ -976,8 +976,8 @@  static inline bool device_is_on_pci_bus(const struct udevice *dev)
  * @parent: parent device to scan
  */
 #define device_foreach_child_probe(pos, parent)	\
-	for (int _ret = device_first_child_err(parent, &dev); !_ret; \
-	     _ret = device_next_child_err(&dev))
+	for (int _ret = device_first_child_err(parent, &pos); !_ret; \
+	     _ret = device_next_child_err(&pos))
 
 /**
  * dm_scan_fdt_dev() - Bind child device in the device tree