Skip to content

Commit 78f8806

Browse files
dev-aaront-orgDanilo Krummrich
authored andcommitted
drm/nouveau: Do not fail module init on debugfs errors
If CONFIG_DEBUG_FS is enabled, nouveau_drm_init() returns an error if it fails to create the "nouveau" directory in debugfs. One case where that will happen is when debugfs access is restricted by CONFIG_DEBUG_FS_ALLOW_NONE or by the boot parameter debugfs=off, which cause the debugfs APIs to return -EPERM. So just ignore errors from debugfs. Note that nouveau_debugfs_root may be an error now, but that is a standard pattern for debugfs. From include/linux/debugfs.h: "NOTE: it's expected that most callers should _ignore_ the errors returned by this function. Other debugfs functions handle the fact that the "dentry" passed to them could be an error and they don't crash in that case. Drivers should generally work fine even if debugfs fails to init anyway." Fixes: 97118a1 ("drm/nouveau: create module debugfs root") Cc: [email protected] Signed-off-by: Aaron Thompson <[email protected]> Acked-by: Timur Tabi <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 226862f commit 78f8806

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

drivers/gpu/drm/nouveau/nouveau_debugfs.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,14 +314,10 @@ nouveau_debugfs_fini(struct nouveau_drm *drm)
314314
drm->debugfs = NULL;
315315
}
316316

317-
int
317+
void
318318
nouveau_module_debugfs_init(void)
319319
{
320320
nouveau_debugfs_root = debugfs_create_dir("nouveau", NULL);
321-
if (IS_ERR(nouveau_debugfs_root))
322-
return PTR_ERR(nouveau_debugfs_root);
323-
324-
return 0;
325321
}
326322

327323
void

drivers/gpu/drm/nouveau/nouveau_debugfs.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern void nouveau_debugfs_fini(struct nouveau_drm *);
2424

2525
extern struct dentry *nouveau_debugfs_root;
2626

27-
int nouveau_module_debugfs_init(void);
27+
void nouveau_module_debugfs_init(void);
2828
void nouveau_module_debugfs_fini(void);
2929
#else
3030
static inline void
@@ -42,10 +42,9 @@ nouveau_debugfs_fini(struct nouveau_drm *drm)
4242
{
4343
}
4444

45-
static inline int
45+
static inline void
4646
nouveau_module_debugfs_init(void)
4747
{
48-
return 0;
4948
}
5049

5150
static inline void

drivers/gpu/drm/nouveau/nouveau_drm.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,9 +1461,7 @@ nouveau_drm_init(void)
14611461
if (!nouveau_modeset)
14621462
return 0;
14631463

1464-
ret = nouveau_module_debugfs_init();
1465-
if (ret)
1466-
return ret;
1464+
nouveau_module_debugfs_init();
14671465

14681466
#ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER
14691467
platform_driver_register(&nouveau_platform_driver);

0 commit comments

Comments
 (0)