* [PATCH] ARM: OMAP3+: PM debug: fix the use of debugfs_create_* API
@ 2012-01-31 11:20 Jean Pihet
2012-01-31 17:44 ` Kevin Hilman
2012-02-01 8:37 ` [PATCH] ARM: OMAP2+: " Jean Pihet
0 siblings, 2 replies; 5+ messages in thread
From: Jean Pihet @ 2012-01-31 11:20 UTC (permalink / raw)
To: linux-arm-kernel
The debugfs_create_* API returns a NULL ptr in case of problem.
Fix the PM debug code to take this into account.
Signed-off-by: Jean Pihet <j-pihet@ti.com>
---
arch/arm/mach-omap2/pm-debug.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 4411163..e5bf367 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -264,8 +264,8 @@ static int __init pm_dbg_init(void)
return 0;
d = debugfs_create_dir("pm_debug", NULL);
- if (IS_ERR(d))
- return PTR_ERR(d);
+ if (!d)
+ return -ENOMEM;
(void) debugfs_create_file("count", S_IRUGO,
d, (void *)DEBUG_FILE_COUNTERS, &debug_fops);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] ARM: OMAP3+: PM debug: fix the use of debugfs_create_* API
2012-01-31 11:20 [PATCH] ARM: OMAP3+: PM debug: fix the use of debugfs_create_* API Jean Pihet
@ 2012-01-31 17:44 ` Kevin Hilman
2012-02-01 8:34 ` Jean Pihet
2012-02-01 8:37 ` [PATCH] ARM: OMAP2+: " Jean Pihet
1 sibling, 1 reply; 5+ messages in thread
From: Kevin Hilman @ 2012-01-31 17:44 UTC (permalink / raw)
To: linux-arm-kernel
Jean Pihet <jean.pihet@newoldbits.com> writes:
> The debugfs_create_* API returns a NULL ptr in case of problem.
> Fix the PM debug code to take this into account.
>
> Signed-off-by: Jean Pihet <j-pihet@ti.com>
> ---
> arch/arm/mach-omap2/pm-debug.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
> index 4411163..e5bf367 100644
> --- a/arch/arm/mach-omap2/pm-debug.c
> +++ b/arch/arm/mach-omap2/pm-debug.c
> @@ -264,8 +264,8 @@ static int __init pm_dbg_init(void)
> return 0;
>
> d = debugfs_create_dir("pm_debug", NULL);
> - if (IS_ERR(d))
> - return PTR_ERR(d);
> + if (!d)
I think this should be IS_ERR_OR_NULL() because this function can also
return ERR_PTR(-ENODEV). (Yes, only when debugfs is not enabled, but
it's still more correct.)
Kevin
> + return -ENOMEM;
> (void) debugfs_create_file("count", S_IRUGO,
> d, (void *)DEBUG_FILE_COUNTERS, &debug_fops);
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ARM: OMAP3+: PM debug: fix the use of debugfs_create_* API
2012-01-31 17:44 ` Kevin Hilman
@ 2012-02-01 8:34 ` Jean Pihet
0 siblings, 0 replies; 5+ messages in thread
From: Jean Pihet @ 2012-02-01 8:34 UTC (permalink / raw)
To: linux-arm-kernel
Kevin,
On Tue, Jan 31, 2012 at 6:44 PM, Kevin Hilman <khilman@ti.com> wrote:
> Jean Pihet <jean.pihet@newoldbits.com> writes:
>
>> The debugfs_create_* API returns a NULL ptr in case of problem.
>> Fix the PM debug code to take this into account.
>>
>> Signed-off-by: Jean Pihet <j-pihet@ti.com>
>> ---
>> ?arch/arm/mach-omap2/pm-debug.c | ? ?4 ++--
>> ?1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
>> index 4411163..e5bf367 100644
>> --- a/arch/arm/mach-omap2/pm-debug.c
>> +++ b/arch/arm/mach-omap2/pm-debug.c
>> @@ -264,8 +264,8 @@ static int __init pm_dbg_init(void)
>> ? ? ? ? ? ? ? return 0;
>>
>> ? ? ? d = debugfs_create_dir("pm_debug", NULL);
>> - ? ? if (IS_ERR(d))
>> - ? ? ? ? ? ? return PTR_ERR(d);
>> + ? ? if (!d)
>
> I think this should be IS_ERR_OR_NULL() because this function can also
> return ERR_PTR(-ENODEV). ?(Yes, only when debugfs is not enabled, but
> it's still more correct.)
That makes sense, even if the PM debug code is enclosed by #ifdef
CONFIG_DEBUG_FS.
I have a new version of the patch, it also fixes another potential
problem with debugfs.
Thanks,
Jean
>
> Kevin
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ARM: OMAP2+: PM debug: fix the use of debugfs_create_* API
2012-01-31 11:20 [PATCH] ARM: OMAP3+: PM debug: fix the use of debugfs_create_* API Jean Pihet
2012-01-31 17:44 ` Kevin Hilman
@ 2012-02-01 8:37 ` Jean Pihet
2012-02-01 17:37 ` Kevin Hilman
1 sibling, 1 reply; 5+ messages in thread
From: Jean Pihet @ 2012-02-01 8:37 UTC (permalink / raw)
To: linux-arm-kernel
Check the return code pointer value from debugfs_create_dir for error
or NULL.
Also added an additional check to prevent the creation of a 'suspend'
entry at the debugfs root in case a power domain directory cannot be
created.
Signed-off-by: Jean Pihet <j-pihet@ti.com>
---
arch/arm/mach-omap2/pm-debug.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 4411163..814bcd9 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -220,8 +220,8 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir)
return 0;
d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir);
-
- (void) debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d,
+ if (!(IS_ERR_OR_NULL(d)))
+ (void) debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d,
(void *)pwrdm, &pwrdm_suspend_fops);
return 0;
@@ -264,7 +264,7 @@ static int __init pm_dbg_init(void)
return 0;
d = debugfs_create_dir("pm_debug", NULL);
- if (IS_ERR(d))
+ if (IS_ERR_OR_NULL(d))
return PTR_ERR(d);
(void) debugfs_create_file("count", S_IRUGO,
--
1.7.5.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] ARM: OMAP2+: PM debug: fix the use of debugfs_create_* API
2012-02-01 8:37 ` [PATCH] ARM: OMAP2+: " Jean Pihet
@ 2012-02-01 17:37 ` Kevin Hilman
0 siblings, 0 replies; 5+ messages in thread
From: Kevin Hilman @ 2012-02-01 17:37 UTC (permalink / raw)
To: linux-arm-kernel
Jean Pihet <jean.pihet@newoldbits.com> writes:
> Check the return code pointer value from debugfs_create_dir for error
> or NULL.
> Also added an additional check to prevent the creation of a 'suspend'
> entry at the debugfs root in case a power domain directory cannot be
> created.
>
> Signed-off-by: Jean Pihet <j-pihet@ti.com>
Thanks, queing for v3.4.
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-02-01 17:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-31 11:20 [PATCH] ARM: OMAP3+: PM debug: fix the use of debugfs_create_* API Jean Pihet
2012-01-31 17:44 ` Kevin Hilman
2012-02-01 8:34 ` Jean Pihet
2012-02-01 8:37 ` [PATCH] ARM: OMAP2+: " Jean Pihet
2012-02-01 17:37 ` Kevin Hilman
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).