* [PATCH] omap2plus: smartreflex: add error checking for debugfs_create_*()
@ 2011-01-27 11:52 Anand S Sawant
0 siblings, 0 replies; only message in thread
From: Anand S Sawant @ 2011-01-27 11:52 UTC (permalink / raw)
To: linux-omap; +Cc: Anand S Sawant
debugfs_create_*() functions return a struct dentry pointer. In
omap_sr_probe(), the pointer is checked if the debug entry created
happens to be a directory. However, it is ignored in case of leaf
nodes viz. while calling debugfs_create_file() and
debugfs_create_x32().
Replace the unnecessary void casts with appropriate error check
of the returned struct dentry pointer and provide a warning in
case of error.
Tested on OMAP3630 Zoom3 and OMAP4430 SDP
Reported-by: Nishanth Menon <nm@ti.com>
Acked-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Charulatha V <charu@ti.com>
Signed-off-by: Anand S Sawant <sawant@ti.com>
---
Based on the latest Kevin's PM branch
arch/arm/mach-omap2/smartreflex.c | 41 +++++++++++++++++++++++++++++++-----
1 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 77ecebf..c57f80f 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -822,7 +822,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
struct omap_sr *sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL);
struct omap_sr_data *pdata = pdev->dev.platform_data;
struct resource *mem, *irq;
- struct dentry *vdd_dbg_dir, *dbg_dir, *nvalue_dir;
+ struct dentry *vdd_dbg_dir, *dbg_dir, *nvalue_dir, *dbg_entry;
struct omap_volt_data *volt_data;
int i, ret = 0;
@@ -901,14 +901,37 @@ static int __init omap_sr_probe(struct platform_device *pdev)
return PTR_ERR(dbg_dir);
}
- (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUGO, dbg_dir,
+ dbg_entry = debugfs_create_file("autocomp", S_IRUGO | S_IWUGO, dbg_dir,
(void *)sr_info, &pm_sr_fops);
- (void) debugfs_create_x32("errweight", S_IRUGO, dbg_dir,
+ if (IS_ERR(dbg_entry)) {
+ dev_warn(&pdev->dev,
+ "%s: Unable to create debugfs entry for autocomp",
+ __func__);
+ }
+
+ dbg_entry = debugfs_create_x32("errweight", S_IRUGO, dbg_dir,
&sr_info->err_weight);
- (void) debugfs_create_x32("errmaxlimit", S_IRUGO, dbg_dir,
+ if (IS_ERR(dbg_entry)) {
+ dev_warn(&pdev->dev,
+ "%s: Unable to create debugfs entry for errweight",
+ __func__);
+ }
+
+ dbg_entry = debugfs_create_x32("errmaxlimit", S_IRUGO, dbg_dir,
&sr_info->err_maxlimit);
- (void) debugfs_create_x32("errminlimit", S_IRUGO, dbg_dir,
+ if (IS_ERR(dbg_entry)) {
+ dev_warn(&pdev->dev,
+ "%s: Unable to create debugfs entry for errmaxlimit",
+ __func__);
+ }
+
+ dbg_entry = debugfs_create_x32("errminlimit", S_IRUGO, dbg_dir,
&sr_info->err_minlimit);
+ if (IS_ERR(dbg_entry)) {
+ dev_warn(&pdev->dev,
+ "%s: Unable to create debugfs entry for errminlimit",
+ __func__);
+ }
nvalue_dir = debugfs_create_dir("nvalue", dbg_dir);
if (IS_ERR(nvalue_dir)) {
@@ -940,8 +963,14 @@ static int __init omap_sr_probe(struct platform_device *pdev)
strcpy(name, "volt_");
sprintf(volt_name, "%d", volt_data[i].volt_nominal);
strcat(name, volt_name);
- (void) debugfs_create_x32(name, S_IRUGO | S_IWUGO, nvalue_dir,
+ dbg_entry = debugfs_create_x32(name, S_IRUGO | S_IWUGO,
+ nvalue_dir,
&(sr_info->nvalue_table[i].nvalue));
+ if (IS_ERR(dbg_entry)) {
+ dev_warn(&pdev->dev,
+ "%s: Unable to create debugfs entry for %s",
+ __func__, name);
+ }
}
return ret;
--
1.7.0.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-01-27 11:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-27 11:52 [PATCH] omap2plus: smartreflex: add error checking for debugfs_create_*() Anand S Sawant
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.