diff mbox series

dm: Use parenthesis for the device_get_ops macro argument

Message ID 20220129192108.6618-1-sughosh.ganu@linaro.org
State Accepted
Commit 82ee8bfe519307b4175bb0f751da73c8555a0a25
Headers show
Series dm: Use parenthesis for the device_get_ops macro argument | expand

Commit Message

Sughosh Ganu Jan. 29, 2022, 7:21 p.m. UTC
Use parenthesis for the device_get_ops macro argument. This prevents
errors when using an expression for the parameter.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
---
 include/dm/device.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass Jan. 30, 2022, 11:14 p.m. UTC | #1
On Sat, 29 Jan 2022 at 12:21, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
>
> Use parenthesis for the device_get_ops macro argument. This prevents
> errors when using an expression for the parameter.
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
>  include/dm/device.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass Feb. 8, 2022, 8:39 p.m. UTC | #2
On Sat, 29 Jan 2022 at 12:21, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
>
> Use parenthesis for the device_get_ops macro argument. This prevents
> errors when using an expression for the parameter.
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
>  include/dm/device.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/include/dm/device.h b/include/dm/device.h
index f790041706..77c27ba92e 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -212,7 +212,7 @@  struct udevice_rt {
 #define DM_MAX_SEQ_STR	3
 
 /* Returns the operations for a device */
-#define device_get_ops(dev)	(dev->driver->ops)
+#define device_get_ops(dev)	((dev)->driver->ops)
 
 #if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
 u32 dev_get_flags(const struct udevice *dev);