From: Thomas Petazzoni <hidden> Date: 2012-11-15 19:18:45
Dear Axel Lin,
On Thu, 15 Nov 2012 12:52:39 +0800, Axel Lin wrote:
of_match_device() may return NULL.
Signed-off-by: Axel Lin <redacted>
Why? We already discussed together that this situation could not
happen: if you are in the probe() function, then there *must* be a
match, because the probe() function precisely gets called when there is
a match.
So unless you give more details about what the problem is, I don't
think this patch and the similar one you sent for Dove are useful.
Best regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
of_match_device() may return NULL.
Signed-off-by: Axel Lin <redacted>
---
This resend CC Jean-Christophe.
drivers/pinctrl/pinctrl-at91.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
this is not possible on at91
and I do a oups here as if we have a NULL pointer which means the driver is
wrong
Best Regards,
J.
quoted hunk
Signed-off-by: Axel Lin <redacted>
---
This resend CC Jean-Christophe.
drivers/pinctrl/pinctrl-at91.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
From: Nicolas Ferre <hidden> Date: 2012-11-16 08:36:50
On 11/15/2012 11:00 AM, Jean-Christophe PLAGNIOL-VILLARD :
On 12:58 Thu 15 Nov , Axel Lin wrote:
quoted
of_match_device() may return NULL.
this is not possible on at91
and I do a oups here as if we have a NULL pointer which means the driver is
wrong
Well, okay, but it does not prevent from adding a supplementary check to
mimic every other pinctrl driver and use a common return path to the
of_match_device() function.
So I am not completely against this patch (that I why I added my Acked-by).
quoted
Signed-off-by: Axel Lin <redacted>
---
This resend CC Jean-Christophe.
drivers/pinctrl/pinctrl-at91.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
On 11/15/2012 11:00 AM, Jean-Christophe PLAGNIOL-VILLARD :
quoted
On 12:58 Thu 15 Nov , Axel Lin wrote:
quoted
of_match_device() may return NULL.
this is not possible on at91
and I do a oups here as if we have a NULL pointer which means the driver is
wrong
Well, okay, but it does not prevent from adding a supplementary check to
mimic every other pinctrl driver and use a common return path to the
of_match_device() function.
So I am not completely against this patch (that I why I added my Acked-by).
here it's a silent warning a oops it clear we have a bug
Best Regards,
J.
quoted
quoted
Signed-off-by: Axel Lin <redacted>
---
This resend CC Jean-Christophe.
drivers/pinctrl/pinctrl-at91.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
@@ -1863,9 +1863,14 @@ static int __devinit nmk_pinctrl_probe(struct platform_device *pdev)if(platid)version=platid->driver_data;-elseif(np)-version=(unsignedint)-of_match_device(nmk_pinctrl_match,&pdev->dev)->data;+elseif(np){+conststructof_device_id*match;++match=of_match_device(nmk_pinctrl_match,&pdev->dev);+if(!match)+return-ENODEV;+version=(unsignedint)match->data;+}/* Poke in other ASIC variants here */if(version==PINCTRL_NMK_STN8815)
@@ -1863,9 +1863,14 @@ static int __devinit nmk_pinctrl_probe(struct platform_device *pdev)if(platid)version=platid->driver_data;-elseif(np)-version=(unsignedint)-of_match_device(nmk_pinctrl_match,&pdev->dev)->data;+elseif(np){+conststructof_device_id*match;++match=of_match_device(nmk_pinctrl_match,&pdev->dev);+if(!match)+return-ENODEV;+version=(unsignedint)match->data;+}
AFAICT this can actually happen so patch applied, unless Lee
speaks against it.
Patches 1-3/4 are dropped though, as the maintainers didn't seem
to like them.
Yours,
Linus Walleij
@@ -1863,9 +1863,14 @@ static int __devinit nmk_pinctrl_probe(struct platform_device *pdev)if(platid)version=platid->driver_data;-elseif(np)-version=(unsignedint)-of_match_device(nmk_pinctrl_match,&pdev->dev)->data;+elseif(np){+conststructof_device_id*match;++match=of_match_device(nmk_pinctrl_match,&pdev->dev);+if(!match)+return-ENODEV;+version=(unsignedint)match->data;+}
AFAICT this can actually happen so patch applied, unless Lee
speaks against it.
At the very least it make the code easy to read.
Acked-by: Lee Jones <redacted>
--
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
From: Thomas Petazzoni <hidden> Date: 2012-11-15 07:35:22
Dear Axel Lin,
On Thu, 15 Nov 2012 12:51:36 +0800, Axel Lin wrote:
of_match_device() may return NULL.
Signed-off-by: Axel Lin <redacted>
Could you detail under what conditions of_match_device() may return
NULL in the specific case of this driver? This of_match_device() call
is using the same dove_pinctrl_of_match array that is used to ->probe()
this driver. So I don't see how you can get into ->probe() without
having a matching entry.
Am I missing something?
Best regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
Dear Axel Lin,
On Thu, 15 Nov 2012 12:51:36 +0800, Axel Lin wrote:
quoted
of_match_device() may return NULL.
Signed-off-by: Axel Lin <redacted>
Could you detail under what conditions of_match_device() may return
NULL in the specific case of this driver? This of_match_device() call
is using the same dove_pinctrl_of_match array that is used to ->probe()
this driver. So I don't see how you can get into ->probe() without
having a matching entry.
Am I missing something?
hi Thomas,
You are right.
I was thinking when the case CONFIG_OF is not selected,
of_match_ptr(dove_pinctrl_of_match) is NULL and of_match_device returns
NULL.
But this driver only works when CONFIG_OF is selected.
BTW, I found there is no way to compile the dove and kirkwood pinctrl
drivers.
I need add below patch to compile these two drivers, how do you think about
below patch?
( In dove, the USE_OF is optional, it is selected only when MACH_DOVE_DT is
enabled )
From: Thomas Petazzoni <hidden> Date: 2012-11-15 13:56:53
Dear Axel Lin,
On Thu, 15 Nov 2012 21:44:07 +0800, Axel Lin wrote:
quoted hunk
BTW, I found there is no way to compile the dove and kirkwood pinctrl
drivers.
I need add below patch to compile these two drivers, how do you think about
below patch?
( In dove, the USE_OF is optional, it is selected only when MACH_DOVE_DT is
enabled )
See "[PATCH 1/5] ARM: Kirkwood: Allow use of pinctrl" and "[PATCH 4/5]
ARM: Dove: Make use of pinctrl driver" which have been posted by Andrew
Lunn on October, 24th.
Best regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com