All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: OMAP: avoid NULL pointer dereference when no PMIC is configured
@ 2011-12-18 19:13 ` Daniel Mack
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Mack @ 2011-12-18 19:13 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-omap, Daniel Mack, Tony Lindgren

Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/vp.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
index 66bd700..5407173 100644
--- a/arch/arm/mach-omap2/vp.c
+++ b/arch/arm/mach-omap2/vp.c
@@ -41,6 +41,11 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
 	u32 val, sys_clk_rate, timeout, waittime;
 	u32 vddmin, vddmax, vstepmin, vstepmax;
 
+	if (!voltdm->pmic) {
+		pr_err("%s: No PMIC configured.\n", __func__, voltdm->name);
+		return;
+	}
+
 	if (!voltdm->read || !voltdm->write) {
 		pr_err("%s: No read/write API for accessing vdd_%s regs\n",
 			__func__, voltdm->name);
-- 
1.7.7.4


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

* [PATCH] ARM: OMAP: avoid NULL pointer dereference when no PMIC is configured
@ 2011-12-18 19:13 ` Daniel Mack
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Mack @ 2011-12-18 19:13 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/vp.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
index 66bd700..5407173 100644
--- a/arch/arm/mach-omap2/vp.c
+++ b/arch/arm/mach-omap2/vp.c
@@ -41,6 +41,11 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
 	u32 val, sys_clk_rate, timeout, waittime;
 	u32 vddmin, vddmax, vstepmin, vstepmax;
 
+	if (!voltdm->pmic) {
+		pr_err("%s: No PMIC configured.\n", __func__, voltdm->name);
+		return;
+	}
+
 	if (!voltdm->read || !voltdm->write) {
 		pr_err("%s: No read/write API for accessing vdd_%s regs\n",
 			__func__, voltdm->name);
-- 
1.7.7.4

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

* Re: [PATCH] ARM: OMAP: avoid NULL pointer dereference when no PMIC is configured
  2011-12-18 19:13 ` Daniel Mack
@ 2011-12-19  8:10   ` Igor Grinberg
  -1 siblings, 0 replies; 6+ messages in thread
From: Igor Grinberg @ 2011-12-19  8:10 UTC (permalink / raw)
  To: Daniel Mack
  Cc: linux-arm-kernel, Tony Lindgren, linux-omap, Paul Walmsley, Kevin Hilman

Hi Daniel,

On 12/18/11 21:13, Daniel Mack wrote:
> Signed-off-by: Daniel Mack <zonque@gmail.com>
> Cc: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/mach-omap2/vp.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
> index 66bd700..5407173 100644
> --- a/arch/arm/mach-omap2/vp.c
> +++ b/arch/arm/mach-omap2/vp.c
> @@ -41,6 +41,11 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
>  	u32 val, sys_clk_rate, timeout, waittime;
>  	u32 vddmin, vddmax, vstepmin, vstepmax;
>  
> +	if (!voltdm->pmic) {
> +		pr_err("%s: No PMIC configured.\n", __func__, voltdm->name);

You are passing two parameters to pr_err(), but use only one...
Also, I don't know if this is the right thing to do here,
so Cc'ed Paul and Kevin.

> +		return;
> +	}
> +
>  	if (!voltdm->read || !voltdm->write) {
>  		pr_err("%s: No read/write API for accessing vdd_%s regs\n",
>  			__func__, voltdm->name);

-- 
Regards,
Igor.

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

* [PATCH] ARM: OMAP: avoid NULL pointer dereference when no PMIC is configured
@ 2011-12-19  8:10   ` Igor Grinberg
  0 siblings, 0 replies; 6+ messages in thread
From: Igor Grinberg @ 2011-12-19  8:10 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Daniel,

On 12/18/11 21:13, Daniel Mack wrote:
> Signed-off-by: Daniel Mack <zonque@gmail.com>
> Cc: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/mach-omap2/vp.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
> index 66bd700..5407173 100644
> --- a/arch/arm/mach-omap2/vp.c
> +++ b/arch/arm/mach-omap2/vp.c
> @@ -41,6 +41,11 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
>  	u32 val, sys_clk_rate, timeout, waittime;
>  	u32 vddmin, vddmax, vstepmin, vstepmax;
>  
> +	if (!voltdm->pmic) {
> +		pr_err("%s: No PMIC configured.\n", __func__, voltdm->name);

You are passing two parameters to pr_err(), but use only one...
Also, I don't know if this is the right thing to do here,
so Cc'ed Paul and Kevin.

> +		return;
> +	}
> +
>  	if (!voltdm->read || !voltdm->write) {
>  		pr_err("%s: No read/write API for accessing vdd_%s regs\n",
>  			__func__, voltdm->name);

-- 
Regards,
Igor.

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

* Re: [PATCH] ARM: OMAP: avoid NULL pointer dereference when no PMIC is configured
  2011-12-19  8:10   ` Igor Grinberg
@ 2011-12-20 10:00     ` Daniel Mack
  -1 siblings, 0 replies; 6+ messages in thread
From: Daniel Mack @ 2011-12-20 10:00 UTC (permalink / raw)
  To: Igor Grinberg
  Cc: linux-arm-kernel, Tony Lindgren, linux-omap, Paul Walmsley, Kevin Hilman

Hi Igor,

On 12/19/2011 09:10 AM, Igor Grinberg wrote:
> On 12/18/11 21:13, Daniel Mack wrote:
>> Signed-off-by: Daniel Mack <zonque@gmail.com>
>> Cc: Tony Lindgren <tony@atomide.com>
>> ---
>>  arch/arm/mach-omap2/vp.c |    5 +++++
>>  1 files changed, 5 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
>> index 66bd700..5407173 100644
>> --- a/arch/arm/mach-omap2/vp.c
>> +++ b/arch/arm/mach-omap2/vp.c
>> @@ -41,6 +41,11 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
>>  	u32 val, sys_clk_rate, timeout, waittime;
>>  	u32 vddmin, vddmax, vstepmin, vstepmax;
>>  
>> +	if (!voltdm->pmic) {
>> +		pr_err("%s: No PMIC configured.\n", __func__, voltdm->name);
> 
> You are passing two parameters to pr_err(), but use only one...

Of course not. I wonder why the compiler didn't yell at me about that.

> Also, I don't know if this is the right thing to do here,
> so Cc'ed Paul and Kevin.

That is the other question ideed. In the case I was facing on a custom
board, I was running into this without any configured PMIC. Clearly,
derferencing a NULL pointer here is no good thing to do.



Thanks,
Daniel




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

* [PATCH] ARM: OMAP: avoid NULL pointer dereference when no PMIC is configured
@ 2011-12-20 10:00     ` Daniel Mack
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Mack @ 2011-12-20 10:00 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Igor,

On 12/19/2011 09:10 AM, Igor Grinberg wrote:
> On 12/18/11 21:13, Daniel Mack wrote:
>> Signed-off-by: Daniel Mack <zonque@gmail.com>
>> Cc: Tony Lindgren <tony@atomide.com>
>> ---
>>  arch/arm/mach-omap2/vp.c |    5 +++++
>>  1 files changed, 5 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
>> index 66bd700..5407173 100644
>> --- a/arch/arm/mach-omap2/vp.c
>> +++ b/arch/arm/mach-omap2/vp.c
>> @@ -41,6 +41,11 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
>>  	u32 val, sys_clk_rate, timeout, waittime;
>>  	u32 vddmin, vddmax, vstepmin, vstepmax;
>>  
>> +	if (!voltdm->pmic) {
>> +		pr_err("%s: No PMIC configured.\n", __func__, voltdm->name);
> 
> You are passing two parameters to pr_err(), but use only one...

Of course not. I wonder why the compiler didn't yell at me about that.

> Also, I don't know if this is the right thing to do here,
> so Cc'ed Paul and Kevin.

That is the other question ideed. In the case I was facing on a custom
board, I was running into this without any configured PMIC. Clearly,
derferencing a NULL pointer here is no good thing to do.



Thanks,
Daniel

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

end of thread, other threads:[~2011-12-20 10:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-18 19:13 [PATCH] ARM: OMAP: avoid NULL pointer dereference when no PMIC is configured Daniel Mack
2011-12-18 19:13 ` Daniel Mack
2011-12-19  8:10 ` Igor Grinberg
2011-12-19  8:10   ` Igor Grinberg
2011-12-20 10:00   ` Daniel Mack
2011-12-20 10:00     ` Daniel Mack

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.