diff mbox series

[-next] can: mscan: mpc5xxx: Use of_property_present() helper

Message ID 20230221024541.105199-1-yang.lee@linux.alibaba.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [-next] can: mscan: mpc5xxx: Use of_property_present() helper | expand

Checks

Context Check Description
netdev/tree_selection success Series ignored based on subject

Commit Message

Yang Li Feb. 21, 2023, 2:45 a.m. UTC
Use of_property_present() instead of of_get_property/of_find_property()
in places where we just need to test presence of a property.

Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/net/can/mscan/mpc5xxx_can.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pavan Chebbi Feb. 21, 2023, 4:35 a.m. UTC | #1
On Tue, Feb 21, 2023 at 8:15 AM Yang Li <yang.lee@linux.alibaba.com> wrote:
>
> 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?

> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  drivers/net/can/mscan/mpc5xxx_can.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
> index b0ed798ae70f..8981c223181f 100644
> --- a/drivers/net/can/mscan/mpc5xxx_can.c
> +++ b/drivers/net/can/mscan/mpc5xxx_can.c
> @@ -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
>
Marc Kleine-Budde Feb. 21, 2023, 8:42 a.m. UTC | #2
On 21.02.2023 10:45:41, Yang Li wrote:
> Use of_property_present() instead of of_get_property/of_find_property()
> in places where we just need to test presence of a property.
> 
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>

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
diff mbox series

Patch

diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
index b0ed798ae70f..8981c223181f 100644
--- a/drivers/net/can/mscan/mpc5xxx_can.c
+++ b/drivers/net/can/mscan/mpc5xxx_can.c
@@ -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,