Skip to contentSkip to conversation

can: mscan: mpc5xxx: Use of_property_present() helper

PATCH NAK Yang Li 3 participants 3 messages Feb 21, 2023

Subsystems (3)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 can: mscan: mpc5xxx: Use of_property_present() helper

Use of_property_present() instead of of_get_property/of_find_property() in places where we just need to test presence of a property.

---
 drivers/net/can/mscan/mpc5xxx_can.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/mscan/mpc5xxx_can.c +1 -1
index b0ed798ae70f..8981c223181f 100644
@@ -315,7 +315,7 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
 	priv->reg_base = base;
 	dev->irq = irq;
 
-	clock_name = of_get_property(np, "fsl,mscan-clock-source", NULL);
+	clock_name = of_property_present(np, "fsl,mscan-clock-source");
 
 	priv->type = data->type;
 	priv->can.clock.freq = data->get_clock(ofdev, clock_name,
Signature · 1 line
2.20.1.7.g153144c
#1 lore raw
Quoted 4 lines · Yang Li

Use of_property_present() instead of of_get_property/of_find_property() in places where we just need to test presence of a property.

Please fix the subject and make sure validation is done. I doubt this will pass. What problem is the patch trying to solve?

Quoted 21 lines
---
 drivers/net/can/mscan/mpc5xxx_can.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/mscan/mpc5xxx_can.c +1 -2
index b0ed798ae70f..8981c223181f 100644
@@ -315,7 +315,7 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
        priv->reg_base = base;
        dev->irq = irq;
 
-       clock_name = of_get_property(np, "fsl,mscan-clock-source", NULL);
+       clock_name = of_property_present(np, "fsl,mscan-clock-source");
 
        priv->type = data->type;
        priv->can.clock.freq = data->get_clock(ofdev, clock_name,
--

2.20.1.7.g153144c

maintainer NAK
#2 lore raw
In reply to Yang Li
Quoted 4 lines · Yang Li

Use of_property_present() instead of of_get_property/of_find_property() in places where we just need to test presence of a property.

NAK!

Besides the things Pavan Chebbi says, this is not even compile:

| drivers/net/can/mscan/mpc5xxx_can.c: In function ‘mpc5xxx_can_probe’:
| drivers/net/can/mscan/mpc5xxx_can.c:318:22: error: implicit declaration of function ‘of_property_present’; did you mean ‘fwnode_property_present’? [-Werror=implicit-function-declaration]
|   318 |         clock_name = of_property_present(np, "fsl,mscan-clock-source");
|       |                      ^~~~~~~~~~~~~~~~~~~
|       |                      fwnode_property_present
| drivers/net/can/mscan/mpc5xxx_can.c:318:20: error: assignment to ‘const char *’ from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
|   318 |         clock_name = of_property_present(np, "fsl,mscan-clock-source");
|       |                    ^
| cc1: all warnings being treated as errors

Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |