All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk/samsung: Use of_device_get_match_data()
@ 2022-03-03  9:22 ` cgel.zte
  0 siblings, 0 replies; 8+ messages in thread
From: cgel.zte @ 2022-03-03  9:22 UTC (permalink / raw)
  To: s.nawrocki
  Cc: tomasz.figa, cw00.choi, alim.akhtar, mturquette, sboyd,
	krzysztof.kozlowski, linux-samsung-soc, linux-clk,
	linux-arm-kernel, linux-kernel, Minghao Chi, Zeal Robot

From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>

Use of_device_get_match_data() to simplify the code.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
---
 drivers/clk/samsung/clk-exynos-clkout.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c
index e6d6cbf8c4e6..feed1a347c09 100644
--- a/drivers/clk/samsung/clk-exynos-clkout.c
+++ b/drivers/clk/samsung/clk-exynos-clkout.c
@@ -81,19 +81,13 @@ MODULE_DEVICE_TABLE(of, exynos_clkout_ids);
 static int exynos_clkout_match_parent_dev(struct device *dev, u32 *mux_mask)
 {
 	const struct exynos_clkout_variant *variant;
-	const struct of_device_id *match;
 
 	if (!dev->parent) {
 		dev_err(dev, "not instantiated from MFD\n");
 		return -EINVAL;
 	}
 
-	match = of_match_device(exynos_clkout_ids, dev->parent);
-	if (!match) {
-		dev_err(dev, "cannot match parent device\n");
-		return -EINVAL;
-	}
-	variant = match->data;
+	variant = of_device_get_match_data(dev->parent);
 
 	*mux_mask = variant->mux_mask;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] clk/samsung: Use of_device_get_match_data()
@ 2022-03-03  9:22 ` cgel.zte
  0 siblings, 0 replies; 8+ messages in thread
From: cgel.zte @ 2022-03-03  9:22 UTC (permalink / raw)
  To: s.nawrocki
  Cc: tomasz.figa, cw00.choi, alim.akhtar, mturquette, sboyd,
	krzysztof.kozlowski, linux-samsung-soc, linux-clk,
	linux-arm-kernel, linux-kernel, Minghao Chi, Zeal Robot

From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>

Use of_device_get_match_data() to simplify the code.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
---
 drivers/clk/samsung/clk-exynos-clkout.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c
index e6d6cbf8c4e6..feed1a347c09 100644
--- a/drivers/clk/samsung/clk-exynos-clkout.c
+++ b/drivers/clk/samsung/clk-exynos-clkout.c
@@ -81,19 +81,13 @@ MODULE_DEVICE_TABLE(of, exynos_clkout_ids);
 static int exynos_clkout_match_parent_dev(struct device *dev, u32 *mux_mask)
 {
 	const struct exynos_clkout_variant *variant;
-	const struct of_device_id *match;
 
 	if (!dev->parent) {
 		dev_err(dev, "not instantiated from MFD\n");
 		return -EINVAL;
 	}
 
-	match = of_match_device(exynos_clkout_ids, dev->parent);
-	if (!match) {
-		dev_err(dev, "cannot match parent device\n");
-		return -EINVAL;
-	}
-	variant = match->data;
+	variant = of_device_get_match_data(dev->parent);
 
 	*mux_mask = variant->mux_mask;
 
-- 
2.25.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] 8+ messages in thread

* Re: [PATCH] clk/samsung: Use of_device_get_match_data()
  2022-03-03  9:22 ` cgel.zte
@ 2022-03-03  9:37   ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2022-03-03  9:37 UTC (permalink / raw)
  To: cgel.zte, s.nawrocki
  Cc: tomasz.figa, cw00.choi, alim.akhtar, mturquette, sboyd,
	linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel,
	Minghao Chi, Zeal Robot

On 03/03/2022 10:22, cgel.zte@gmail.com wrote:
> From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
> 
> Use of_device_get_match_data() to simplify the code.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>

Where is the bug report to be credited? Where is the actual bug which
justifies usage of "Reported-by" tag (it is *only* for crediting bug
reporters)? Last time this email was invalid - why do you add invalid
emails to commit log?

NAK.

Please resend without this.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] clk/samsung: Use of_device_get_match_data()
@ 2022-03-03  9:37   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2022-03-03  9:37 UTC (permalink / raw)
  To: cgel.zte, s.nawrocki
  Cc: tomasz.figa, cw00.choi, alim.akhtar, mturquette, sboyd,
	linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel,
	Minghao Chi, Zeal Robot

On 03/03/2022 10:22, cgel.zte@gmail.com wrote:
> From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
> 
> Use of_device_get_match_data() to simplify the code.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>

Where is the bug report to be credited? Where is the actual bug which
justifies usage of "Reported-by" tag (it is *only* for crediting bug
reporters)? Last time this email was invalid - why do you add invalid
emails to commit log?

NAK.

Please resend without this.

Best regards,
Krzysztof

_______________________________________________
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] 8+ messages in thread

* [PATCH] clk/samsung: Use of_device_get_match_data()
  2022-03-03  9:37   ` Krzysztof Kozlowski
@ 2022-03-04  1:11     ` cgel.zte
  -1 siblings, 0 replies; 8+ messages in thread
From: cgel.zte @ 2022-03-04  1:11 UTC (permalink / raw)
  To: krzysztof.kozlowski
  Cc: alim.akhtar, cgel.zte, chi.minghao, cw00.choi, linux-arm-kernel,
	linux-clk, linux-kernel, linux-samsung-soc, mturquette,
	s.nawrocki, sboyd, tomasz.figa, zealci

From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>

Use of_device_get_match_data() to simplify the code.

Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
---
 drivers/clk/samsung/clk-exynos-clkout.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c
index e6d6cbf8c4e6..feed1a347c09 100644
--- a/drivers/clk/samsung/clk-exynos-clkout.c
+++ b/drivers/clk/samsung/clk-exynos-clkout.c
@@ -81,19 +81,13 @@ MODULE_DEVICE_TABLE(of, exynos_clkout_ids);
 static int exynos_clkout_match_parent_dev(struct device *dev, u32 *mux_mask)
 {
 	const struct exynos_clkout_variant *variant;
-	const struct of_device_id *match;
 
 	if (!dev->parent) {
 		dev_err(dev, "not instantiated from MFD\n");
 		return -EINVAL;
 	}
 
-	match = of_match_device(exynos_clkout_ids, dev->parent);
-	if (!match) {
-		dev_err(dev, "cannot match parent device\n");
-		return -EINVAL;
-	}
-	variant = match->data;
+	variant = of_device_get_match_data(dev->parent);
 
 	*mux_mask = variant->mux_mask;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] clk/samsung: Use of_device_get_match_data()
@ 2022-03-04  1:11     ` cgel.zte
  0 siblings, 0 replies; 8+ messages in thread
From: cgel.zte @ 2022-03-04  1:11 UTC (permalink / raw)
  To: krzysztof.kozlowski
  Cc: alim.akhtar, cgel.zte, chi.minghao, cw00.choi, linux-arm-kernel,
	linux-clk, linux-kernel, linux-samsung-soc, mturquette,
	s.nawrocki, sboyd, tomasz.figa, zealci

From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>

Use of_device_get_match_data() to simplify the code.

Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
---
 drivers/clk/samsung/clk-exynos-clkout.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c
index e6d6cbf8c4e6..feed1a347c09 100644
--- a/drivers/clk/samsung/clk-exynos-clkout.c
+++ b/drivers/clk/samsung/clk-exynos-clkout.c
@@ -81,19 +81,13 @@ MODULE_DEVICE_TABLE(of, exynos_clkout_ids);
 static int exynos_clkout_match_parent_dev(struct device *dev, u32 *mux_mask)
 {
 	const struct exynos_clkout_variant *variant;
-	const struct of_device_id *match;
 
 	if (!dev->parent) {
 		dev_err(dev, "not instantiated from MFD\n");
 		return -EINVAL;
 	}
 
-	match = of_match_device(exynos_clkout_ids, dev->parent);
-	if (!match) {
-		dev_err(dev, "cannot match parent device\n");
-		return -EINVAL;
-	}
-	variant = match->data;
+	variant = of_device_get_match_data(dev->parent);
 
 	*mux_mask = variant->mux_mask;
 
-- 
2.25.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] 8+ messages in thread

* Re: [PATCH] clk/samsung: Use of_device_get_match_data()
  2022-03-04  1:11     ` cgel.zte
@ 2022-03-04  7:07       ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2022-03-04  7:07 UTC (permalink / raw)
  To: cgel.zte
  Cc: alim.akhtar, chi.minghao, cw00.choi, linux-arm-kernel, linux-clk,
	linux-kernel, linux-samsung-soc, mturquette, s.nawrocki, sboyd,
	tomasz.figa, zealci

On 04/03/2022 02:11, cgel.zte@gmail.com wrote:
> From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
> 
> Use of_device_get_match_data() to simplify the code.
> 
> Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
> ---
>  drivers/clk/samsung/clk-exynos-clkout.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c
> index e6d6cbf8c4e6..feed1a347c09 100644
> --- a/drivers/clk/samsung/clk-exynos-clkout.c
> +++ b/drivers/clk/samsung/clk-exynos-clkout.c
> @@ -81,19 +81,13 @@ MODULE_DEVICE_TABLE(of, exynos_clkout_ids);
>  static int exynos_clkout_match_parent_dev(struct device *dev, u32 *mux_mask)
>  {
>  	const struct exynos_clkout_variant *variant;
> -	const struct of_device_id *match;
>  
>  	if (!dev->parent) {
>  		dev_err(dev, "not instantiated from MFD\n");
>  		return -EINVAL;
>  	}
>  
> -	match = of_match_device(exynos_clkout_ids, dev->parent);
> -	if (!match) {
> -		dev_err(dev, "cannot match parent device\n");
> -		return -EINVAL;
> -	}
> -	variant = match->data;
> +	variant = of_device_get_match_data(dev->parent);
>  

What about possible NULL pointer exception? Device is being instantiated
by MFD, so the match here could be false if MFD driver is updated but
this one here not. With your change returned NULL will be dereferenced
line below.

>  	*mux_mask = variant->mux_mask;
>  


Best regards,
Krzysztof

_______________________________________________
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] 8+ messages in thread

* Re: [PATCH] clk/samsung: Use of_device_get_match_data()
@ 2022-03-04  7:07       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2022-03-04  7:07 UTC (permalink / raw)
  To: cgel.zte
  Cc: alim.akhtar, chi.minghao, cw00.choi, linux-arm-kernel, linux-clk,
	linux-kernel, linux-samsung-soc, mturquette, s.nawrocki, sboyd,
	tomasz.figa, zealci

On 04/03/2022 02:11, cgel.zte@gmail.com wrote:
> From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
> 
> Use of_device_get_match_data() to simplify the code.
> 
> Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
> ---
>  drivers/clk/samsung/clk-exynos-clkout.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c
> index e6d6cbf8c4e6..feed1a347c09 100644
> --- a/drivers/clk/samsung/clk-exynos-clkout.c
> +++ b/drivers/clk/samsung/clk-exynos-clkout.c
> @@ -81,19 +81,13 @@ MODULE_DEVICE_TABLE(of, exynos_clkout_ids);
>  static int exynos_clkout_match_parent_dev(struct device *dev, u32 *mux_mask)
>  {
>  	const struct exynos_clkout_variant *variant;
> -	const struct of_device_id *match;
>  
>  	if (!dev->parent) {
>  		dev_err(dev, "not instantiated from MFD\n");
>  		return -EINVAL;
>  	}
>  
> -	match = of_match_device(exynos_clkout_ids, dev->parent);
> -	if (!match) {
> -		dev_err(dev, "cannot match parent device\n");
> -		return -EINVAL;
> -	}
> -	variant = match->data;
> +	variant = of_device_get_match_data(dev->parent);
>  

What about possible NULL pointer exception? Device is being instantiated
by MFD, so the match here could be false if MFD driver is updated but
this one here not. With your change returned NULL will be dereferenced
line below.

>  	*mux_mask = variant->mux_mask;
>  


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-03-04  7:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03  9:22 [PATCH] clk/samsung: Use of_device_get_match_data() cgel.zte
2022-03-03  9:22 ` cgel.zte
2022-03-03  9:37 ` Krzysztof Kozlowski
2022-03-03  9:37   ` Krzysztof Kozlowski
2022-03-04  1:11   ` cgel.zte
2022-03-04  1:11     ` cgel.zte
2022-03-04  7:07     ` Krzysztof Kozlowski
2022-03-04  7:07       ` Krzysztof Kozlowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.