From: Matthew Brost <matthew.brost@intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH] drm/xe: Drop unnecessary goto in xe_device_create
Date: Wed, 4 Feb 2026 11:35:00 -0800 [thread overview]
Message-ID: <aYOfZKjaGufsbN/+@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20260204191025.3957211-2-matthew.d.roper@intel.com>
On Wed, Feb 04, 2026 at 11:10:26AM -0800, Matt Roper wrote:
> The error label in this function just does an immediate return without
> any further cleanup or processing. Replace the goto statements with
> returns.
>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/xe/xe_device.c | 20 ++++++++------------
> 1 file changed, 8 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index 055084fa50e5..743c18e0c580 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -456,16 +456,16 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
> xe->drm.anon_inode->i_mapping,
> xe->drm.vma_offset_manager, 0);
> if (WARN_ON(err))
> - goto err;
> + return ERR_PTR(err);
>
> xe_bo_dev_init(&xe->bo_device);
> err = drmm_add_action_or_reset(&xe->drm, xe_device_destroy, NULL);
> if (err)
> - goto err;
> + return ERR_PTR(err);
>
> err = xe_shrinker_create(xe);
> if (err)
> - goto err;
> + return ERR_PTR(err);
>
> xe->info.devid = pdev->device;
> xe->info.revid = pdev->revision;
> @@ -475,7 +475,7 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
>
> err = xe_irq_init(xe);
> if (err)
> - goto err;
> + return ERR_PTR(err);
>
> xe_validation_device_init(&xe->val);
>
> @@ -485,7 +485,7 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
>
> err = xe_pagemap_shrinker_create(xe);
> if (err)
> - goto err;
> + return ERR_PTR(err);
>
> xa_init_flags(&xe->usm.asid_to_vm, XA_FLAGS_ALLOC);
>
> @@ -504,7 +504,7 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
>
> err = xe_bo_pinned_init(xe);
> if (err)
> - goto err;
> + return ERR_PTR(err);
>
> xe->preempt_fence_wq = alloc_ordered_workqueue("xe-preempt-fence-wq",
> WQ_MEM_RECLAIM);
> @@ -518,18 +518,14 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
> * drmm_add_action_or_reset register above
> */
> drm_err(&xe->drm, "Failed to allocate xe workqueues\n");
> - err = -ENOMEM;
> - goto err;
> + return ERR_PTR(-ENOMEM);
> }
>
> err = drmm_mutex_init(&xe->drm, &xe->pmt.lock);
> if (err)
> - goto err;
> + return ERR_PTR(err);
>
> return xe;
> -
> -err:
> - return ERR_PTR(err);
> }
> ALLOW_ERROR_INJECTION(xe_device_create, ERRNO); /* See xe_pci_probe() */
>
> --
> 2.52.0
>
next prev parent reply other threads:[~2026-02-04 19:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-04 19:10 [PATCH] drm/xe: Drop unnecessary goto in xe_device_create Matt Roper
2026-02-04 19:35 ` Matthew Brost [this message]
2026-02-05 5:43 ` ✓ CI.KUnit: success for " Patchwork
2026-02-05 6:17 ` ✓ Xe.CI.BAT: " Patchwork
2026-02-05 23:17 ` ✗ Xe.CI.FULL: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aYOfZKjaGufsbN/+@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.d.roper@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox