Skip to content

Commit e5445ee

Browse files
AxelLingregkh
authored andcommitted
memory: emif: Add ifdef CONFIG_DEBUG_FS guard for emif_debugfs_[init|exit]
Add ifdef CONFIG_DEBUG_FS guard for emif_debugfs_[init|exit], and adds stub functions for the case CONFIG_DEBUG_FS is not set. When CONFIG_DEBUG_FS is enabled, debugfs_create_dir and debugfs_create_file return NULL on failure, fix it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by : Santosh Shilimkar <santosh.shilimkar@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1980a34 commit e5445ee

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

‎drivers/memory/emif.c‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ static unsigned long irq_state;
7575
static u32 t_ck; /* DDR clock period in ps */
7676
static LIST_HEAD(device_list);
7777

78+
#ifdef CONFIG_DEBUG_FS
7879
static void do_emif_regdump_show(struct seq_file *s, struct emif_data *emif,
7980
struct emif_regs *regs)
8081
{
@@ -166,23 +167,23 @@ static int __init_or_module emif_debugfs_init(struct emif_data *emif)
166167
int ret;
167168

168169
dentry = debugfs_create_dir(dev_name(emif->dev), NULL);
169-
if (IS_ERR(dentry)) {
170-
ret = PTR_ERR(dentry);
170+
if (!dentry) {
171+
ret = -ENOMEM;
171172
goto err0;
172173
}
173174
emif->debugfs_root = dentry;
174175

175176
dentry = debugfs_create_file("regcache_dump", S_IRUGO,
176177
emif->debugfs_root, emif, &emif_regdump_fops);
177-
if (IS_ERR(dentry)) {
178-
ret = PTR_ERR(dentry);
178+
if (!dentry) {
179+
ret = -ENOMEM;
179180
goto err1;
180181
}
181182

182183
dentry = debugfs_create_file("mr4", S_IRUGO,
183184
emif->debugfs_root, emif, &emif_mr4_fops);
184-
if (IS_ERR(dentry)) {
185-
ret = PTR_ERR(dentry);
185+
if (!dentry) {
186+
ret = -ENOMEM;
186187
goto err1;
187188
}
188189

@@ -198,6 +199,16 @@ static void __exit emif_debugfs_exit(struct emif_data *emif)
198199
debugfs_remove_recursive(emif->debugfs_root);
199200
emif->debugfs_root = NULL;
200201
}
202+
#else
203+
static inline int __init_or_module emif_debugfs_init(struct emif_data *emif)
204+
{
205+
return 0;
206+
}
207+
208+
static inline void __exit emif_debugfs_exit(struct emif_data *emif)
209+
{
210+
}
211+
#endif
201212

202213
/*
203214
* Calculate the period of DDR clock from frequency value

0 commit comments

Comments
 (0)