linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: tegra: don't open code of_device_get_match_data()
@ 2016-02-21 13:57 Wolfram Sang
       [not found] ` <1456063089-3403-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2016-02-21 13:57 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Laxman Dewangan, Stephen Warren, Thierry Reding,
	Alexandre Courbot, linux-tegra

From: Wolfram Sang <wolfram@the-dreams.de>

This change will also make Coverity happy by avoiding a theoretical NULL
pointer dereference; yet another reason is to use the above helper function
to tighten the code and make it more readable.

Signed-off-by: Wolfram Sang <wolfram@the-dreams.de>
---

Compile tested only; HW test would be much appreciated!

 drivers/i2c/busses/i2c-tegra.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index a0522fcc4ff875..929185a7296c0e 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -805,9 +805,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
 	i2c_dev->hw = &tegra20_i2c_hw;
 
 	if (pdev->dev.of_node) {
-		const struct of_device_id *match;
-		match = of_match_device(tegra_i2c_of_match, &pdev->dev);
-		i2c_dev->hw = match->data;
+		i2c_dev->hw = of_device_get_match_data(&pdev->dev);
 		i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node,
 						"nvidia,tegra20-i2c-dvc");
 	} else if (pdev->id == 3) {
-- 
2.7.0

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

* Re: [PATCH] i2c: tegra: don't open code of_device_get_match_data()
       [not found] ` <1456063089-3403-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
@ 2016-02-22  9:18   ` Laxman Dewangan
       [not found]     ` <56CAD248.8060301-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  2016-02-24 10:25   ` Wolfram Sang
  1 sibling, 1 reply; 4+ messages in thread
From: Laxman Dewangan @ 2016-02-22  9:18 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: Stephen Warren, Thierry Reding, Alexandre Courbot,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA


On Sunday 21 February 2016 07:27 PM, Wolfram Sang wrote:
> From: Wolfram Sang <wolfram-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
>
> This change will also make Coverity happy by avoiding a theoretical NULL
> pointer dereference; yet another reason is to use the above helper function
> to tighten the code and make it more readable.
>
> Signed-off-by: Wolfram Sang <wolfram-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
> ---
>
> Compile tested only; HW test would be much appreciated!
>


Tested on Jetson-TX1.

Acked-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Tested-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>


There is some more cleanups needed on this driver i.e. do not support 
non-DT, move the of_table to down etc. I like to post follow up post 
after this is applied.

Thanks,
Laxman

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

* Re: [PATCH] i2c: tegra: don't open code of_device_get_match_data()
       [not found] ` <1456063089-3403-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
  2016-02-22  9:18   ` Laxman Dewangan
@ 2016-02-24 10:25   ` Wolfram Sang
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2016-02-24 10:25 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: Laxman Dewangan, Stephen Warren, Thierry Reding,
	Alexandre Courbot, linux-tegra-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 463 bytes --]

On Sun, Feb 21, 2016 at 02:57:42PM +0100, Wolfram Sang wrote:
> From: Wolfram Sang <wolfram-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
> 
> This change will also make Coverity happy by avoiding a theoretical NULL
> pointer dereference; yet another reason is to use the above helper function
> to tighten the code and make it more readable.
> 
> Signed-off-by: Wolfram Sang <wolfram-z923LK4zBo2bacvFa/9K2g@public.gmane.org>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH] i2c: tegra: don't open code of_device_get_match_data()
       [not found]     ` <56CAD248.8060301-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2016-02-24 10:26       ` Wolfram Sang
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2016-02-24 10:26 UTC (permalink / raw)
  To: Laxman Dewangan
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Stephen Warren, Thierry Reding,
	Alexandre Courbot, linux-tegra-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 647 bytes --]


> >This change will also make Coverity happy by avoiding a theoretical NULL
> >pointer dereference; yet another reason is to use the above helper function
> >to tighten the code and make it more readable.
> >
> >Signed-off-by: Wolfram Sang <wolfram-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
> >---
> >
> >Compile tested only; HW test would be much appreciated!
> 
> Tested on Jetson-TX1.

Thanks!

> There is some more cleanups needed on this driver i.e. do not support
> non-DT, move the of_table to down etc. I like to post follow up post after
> this is applied.

Please do. This is applied now, I'll push out later today.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2016-02-24 10:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-21 13:57 [PATCH] i2c: tegra: don't open code of_device_get_match_data() Wolfram Sang
     [not found] ` <1456063089-3403-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2016-02-22  9:18   ` Laxman Dewangan
     [not found]     ` <56CAD248.8060301-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-02-24 10:26       ` Wolfram Sang
2016-02-24 10:25   ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).