[PATCH 2/4] drm/imagination: Remove goto label that are only used once

Liao Yuanhong liaoyuanhong at vivo.com
Tue Aug 5 07:46:17 UTC 2025


Remove unnecessary goto labels to improve code readability. 

Signed-off-by: Liao Yuanhong <liaoyuanhong at vivo.com>
---
 drivers/gpu/drm/imagination/pvr_cccb.c         |  8 ++------
 drivers/gpu/drm/imagination/pvr_fw_startstop.c | 13 +++++--------
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/imagination/pvr_cccb.c b/drivers/gpu/drm/imagination/pvr_cccb.c
index 4fabab41bea7..ed7e1c8fb71b 100644
--- a/drivers/gpu/drm/imagination/pvr_cccb.c
+++ b/drivers/gpu/drm/imagination/pvr_cccb.c
@@ -69,18 +69,14 @@ pvr_cccb_init(struct pvr_device *pvr_dev, struct pvr_cccb *pvr_cccb,
 						      NULL, NULL, &pvr_cccb->cccb_obj);
 	if (IS_ERR(pvr_cccb->cccb)) {
 		err = PTR_ERR(pvr_cccb->cccb);
-		goto err_free_ctrl;
+		pvr_fw_object_unmap_and_destroy(pvr_cccb->ctrl_obj);
+		return err;
 	}
 
 	pvr_fw_object_get_fw_addr(pvr_cccb->ctrl_obj, &pvr_cccb->ctrl_fw_addr);
 	pvr_fw_object_get_fw_addr(pvr_cccb->cccb_obj, &pvr_cccb->cccb_fw_addr);
 
 	return 0;
-
-err_free_ctrl:
-	pvr_fw_object_unmap_and_destroy(pvr_cccb->ctrl_obj);
-
-	return err;
 }
 
 /**
diff --git a/drivers/gpu/drm/imagination/pvr_fw_startstop.c b/drivers/gpu/drm/imagination/pvr_fw_startstop.c
index dcbb9903e791..4921acd4e757 100644
--- a/drivers/gpu/drm/imagination/pvr_fw_startstop.c
+++ b/drivers/gpu/drm/imagination/pvr_fw_startstop.c
@@ -155,8 +155,11 @@ pvr_fw_start(struct pvr_device *pvr_dev)
 		(void)pvr_cr_read64(pvr_dev, ROGUE_CR_SOFT_RESET2);
 
 	err = rogue_slc_init(pvr_dev);
-	if (err)
-		goto err_reset;
+	if (err) {
+		/* Put everything back into soft-reset. */
+		pvr_cr_write64(pvr_dev, ROGUE_CR_SOFT_RESET, soft_reset_mask);
+		return err;
+	}
 
 	/* Initialise Firmware wrapper. */
 	pvr_dev->fw_dev.defs->wrapper_init(pvr_dev);
@@ -185,12 +188,6 @@ pvr_fw_start(struct pvr_device *pvr_dev)
 	}
 
 	return 0;
-
-err_reset:
-	/* Put everything back into soft-reset. */
-	pvr_cr_write64(pvr_dev, ROGUE_CR_SOFT_RESET, soft_reset_mask);
-
-	return err;
 }
 
 /**
-- 
2.34.1



More information about the dri-devel mailing list