Skip to contentSkip to conversation

drm/nouveau: simplify the return expression of nouveau_debugfs_init()

PATCH In review [email protected] 2 participants 2 messages Apr 29, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/nouveau: simplify the return expression of nouveau_debugfs_init()

From: Minghao Chi <[email protected]>

Simplify the return expression.

---
 drivers/gpu/drm/nouveau/nouveau_debugfs.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpu/drm/nouveau/nouveau_debugfs.c +1 -7
index 1cbe01048b93..76b621f99916 100644
@@ -255,19 +255,13 @@ nouveau_drm_debugfs_init(struct drm_minor *minor)
 int
 nouveau_debugfs_init(struct nouveau_drm *drm)
 {
-	int ret;
-
 	drm->debugfs = kzalloc(sizeof(*drm->debugfs), GFP_KERNEL);
 	if (!drm->debugfs)
 		return -ENOMEM;
 
-	ret = nvif_object_ctor(&drm->client.device.object, "debugfsCtrl", 0,
+	return nvif_object_ctor(&drm->client.device.object, "debugfsCtrl", 0,
 			       NVIF_CLASS_CONTROL, NULL, 0,
 			       &drm->debugfs->ctrl);
-	if (ret)
-		return ret;
-
-	return 0;
 }
 
 void
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

Will push to drm-misc-next in a bit

(Kind of impressed that a bot managed to catch this, considering the route from here to the code capable of returning < 0 or 0 was definitely not obvious)

Quoted 37 lines · On Fri, 2022-04-29 at 09:03 +0000, [email protected] wrote:

From: Minghao Chi <[email protected]>

Simplify the return expression.

---
 drivers/gpu/drm/nouveau/nouveau_debugfs.c | 8 +-------

 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpu/drm/nouveau/nouveau_debugfs.c +0 -0
index 1cbe01048b93..76b621f99916 100644
@@ -255,19 +255,13 @@ nouveau_drm_debugfs_init(struct drm_minor *minor)

 int
 nouveau_debugfs_init(struct nouveau_drm *drm)
 {
-       int ret;
-
        drm->debugfs = kzalloc(sizeof(*drm->debugfs), GFP_KERNEL); if (!drm->debugfs)
                return -ENOMEM;

-       ret = nvif_object_ctor(&drm->client.device.object, "debugfsCtrl", 0, +       return nvif_object_ctor(&drm->client.device.object, "debugfsCtrl", 0,
                               NVIF_CLASS_CONTROL, NULL, 0, &drm->debugfs->ctrl);
-       if (ret)
-               return ret;
-
-       return 0;
 }

 void

Signature · 3 lines
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat