]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/vc4: debugfs: Return an error on failure
authorMaxime Ripard <maxime@cerno.tech>
Mon, 11 Jul 2022 17:39:33 +0000 (19:39 +0200)
committerMaxime Ripard <maxime@cerno.tech>
Wed, 13 Jul 2022 08:46:12 +0000 (10:46 +0200)
vc4_debugfs_add_file() can fail, so let's propagate its error code instead
of silencing it.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220711173939.1132294-64-maxime@cerno.tech
drivers/gpu/drm/vc4/vc4_debugfs.c
drivers/gpu/drm/vc4/vc4_drv.h

index d6350a8ca04814854ea6e4a66847e3159ed2b285..b857fb9c94bc648978c452752d888e4e8257f347 100644 (file)
@@ -67,10 +67,10 @@ static int vc4_debugfs_regset32(struct seq_file *m, void *unused)
  * track the request and delay it to be called on each minor during
  * vc4_debugfs_init().
  */
-void vc4_debugfs_add_file(struct drm_device *dev,
-                         const char *name,
-                         int (*show)(struct seq_file*, void*),
-                         void *data)
+int vc4_debugfs_add_file(struct drm_device *dev,
+                        const char *name,
+                        int (*show)(struct seq_file*, void*),
+                        void *data)
 {
        struct vc4_dev *vc4 = to_vc4_dev(dev);
 
@@ -78,18 +78,20 @@ void vc4_debugfs_add_file(struct drm_device *dev,
                devm_kzalloc(dev->dev, sizeof(*entry), GFP_KERNEL);
 
        if (!entry)
-               return;
+               return -ENOMEM;
 
        entry->info.name = name;
        entry->info.show = show;
        entry->info.data = data;
 
        list_add(&entry->link, &vc4->debugfs_list);
+
+       return 0;
 }
 
-void vc4_debugfs_add_regset32(struct drm_device *drm,
-                             const char *name,
-                             struct debugfs_regset32 *regset)
+int vc4_debugfs_add_regset32(struct drm_device *drm,
+                            const char *name,
+                            struct debugfs_regset32 *regset)
 {
-       vc4_debugfs_add_file(drm, name, vc4_debugfs_regset32, regset);
+       return vc4_debugfs_add_file(drm, name, vc4_debugfs_regset32, regset);
 }
index b7ccdc2b09de1e967f24d18a196aa9fbee88d578..5d857816426b670cc0ace67c110189a6da0167e3 100644 (file)
@@ -866,25 +866,27 @@ void vc4_crtc_get_margins(struct drm_crtc_state *state,
 /* vc4_debugfs.c */
 void vc4_debugfs_init(struct drm_minor *minor);
 #ifdef CONFIG_DEBUG_FS
-void vc4_debugfs_add_file(struct drm_device *drm,
-                         const char *filename,
-                         int (*show)(struct seq_file*, void*),
-                         void *data);
-void vc4_debugfs_add_regset32(struct drm_device *drm,
-                             const char *filename,
-                             struct debugfs_regset32 *regset);
+int vc4_debugfs_add_file(struct drm_device *drm,
+                        const char *filename,
+                        int (*show)(struct seq_file*, void*),
+                        void *data);
+int vc4_debugfs_add_regset32(struct drm_device *drm,
+                            const char *filename,
+                            struct debugfs_regset32 *regset);
 #else
-static inline void vc4_debugfs_add_file(struct drm_device *drm,
-                                       const char *filename,
-                                       int (*show)(struct seq_file*, void*),
-                                       void *data)
+static inline int vc4_debugfs_add_file(struct drm_device *drm,
+                                      const char *filename,
+                                      int (*show)(struct seq_file*, void*),
+                                      void *data)
 {
+       return 0;
 }
 
-static inline void vc4_debugfs_add_regset32(struct drm_device *drm,
-                                           const char *filename,
-                                           struct debugfs_regset32 *regset)
+static inline int vc4_debugfs_add_regset32(struct drm_device *drm,
+                                          const char *filename,
+                                          struct debugfs_regset32 *regset)
 {
+       return 0;
 }
 #endif