mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

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: 97118a1816
("drm/nouveau: create module debugfs root")
Cc: stable@vger.kernel.org
Signed-off-by: Aaron Thompson <dev@aaront.org>
Acked-by: Timur Tabi <ttabi@nvidia.com>
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Link: https://lore.kernel.org/r/20250703211949.9916-1-dev@aaront.org
57 lines
1,013 B
C
57 lines
1,013 B
C
/* SPDX-License-Identifier: MIT */
|
|
#ifndef __NOUVEAU_DEBUGFS_H__
|
|
#define __NOUVEAU_DEBUGFS_H__
|
|
|
|
#include <drm/drm_debugfs.h>
|
|
|
|
#if defined(CONFIG_DEBUG_FS)
|
|
|
|
#include "nouveau_drv.h"
|
|
|
|
struct nouveau_debugfs {
|
|
struct nvif_object ctrl;
|
|
};
|
|
|
|
static inline struct nouveau_debugfs *
|
|
nouveau_debugfs(struct drm_device *dev)
|
|
{
|
|
return nouveau_drm(dev)->debugfs;
|
|
}
|
|
|
|
extern void nouveau_drm_debugfs_init(struct drm_minor *);
|
|
extern int nouveau_debugfs_init(struct nouveau_drm *);
|
|
extern void nouveau_debugfs_fini(struct nouveau_drm *);
|
|
|
|
extern struct dentry *nouveau_debugfs_root;
|
|
|
|
void nouveau_module_debugfs_init(void);
|
|
void nouveau_module_debugfs_fini(void);
|
|
#else
|
|
static inline void
|
|
nouveau_drm_debugfs_init(struct drm_minor *minor)
|
|
{}
|
|
|
|
static inline int
|
|
nouveau_debugfs_init(struct nouveau_drm *drm)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline void
|
|
nouveau_debugfs_fini(struct nouveau_drm *drm)
|
|
{
|
|
}
|
|
|
|
static inline void
|
|
nouveau_module_debugfs_init(void)
|
|
{
|
|
}
|
|
|
|
static inline void
|
|
nouveau_module_debugfs_fini(void)
|
|
{
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|