Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 5/9] drm/i915/fb: Init 'ret' in each error branch in intel_framebuffer_init()
Date: Mon, 10 Nov 2025 13:07:51 +0200	[thread overview]
Message-ID: <af1c5d6c1b8fa5b7a7dd36714b187383a4435b03@intel.com> (raw)
In-Reply-To: <20251107181126.5743-6-ville.syrjala@linux.intel.com>

On Fri, 07 Nov 2025, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Make the order of things a bit less fragile in
> intel_framebuffer_init() by assinging 'ret' in each

*assigning

> error branch instead of depending on some earlier
> assignment.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_fb.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c
> index 2eddccb1bc9e..b34b4961fe1c 100644
> --- a/drivers/gpu/drm/i915/display/intel_fb.c
> +++ b/drivers/gpu/drm/i915/display/intel_fb.c
> @@ -2234,13 +2234,13 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
>  	if (ret)
>  		goto err_frontbuffer_put;
>  
> -	ret = -EINVAL;
>  	if (!drm_any_plane_has_format(display->drm,
>  				      mode_cmd->pixel_format,
>  				      mode_cmd->modifier[0])) {
>  		drm_dbg_kms(display->drm,
>  			    "unsupported pixel format %p4cc / modifier 0x%llx\n",
>  			    &mode_cmd->pixel_format, mode_cmd->modifier[0]);
> +		ret = -EINVAL;
>  		goto err_bo_framebuffer_fini;
>  	}
>  
> @@ -2251,6 +2251,7 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
>  			    mode_cmd->modifier[0] != DRM_FORMAT_MOD_LINEAR ?
>  			    "tiled" : "linear",
>  			    mode_cmd->pitches[0], max_stride);
> +		ret = -EINVAL;
>  		goto err_bo_framebuffer_fini;
>  	}
>  
> @@ -2259,6 +2260,7 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
>  		drm_dbg_kms(display->drm,
>  			    "plane 0 offset (0x%08x) must be 0\n",
>  			    mode_cmd->offsets[0]);
> +		ret = -EINVAL;
>  		goto err_bo_framebuffer_fini;
>  	}
>  
> @@ -2269,6 +2271,7 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
>  
>  		if (mode_cmd->handles[i] != mode_cmd->handles[0]) {
>  			drm_dbg_kms(display->drm, "bad plane %d handle\n", i);
> +			ret = -EINVAL;
>  			goto err_bo_framebuffer_fini;
>  		}
>  
> @@ -2277,6 +2280,7 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
>  			drm_dbg_kms(display->drm,
>  				    "plane %d pitch (%d) must be at least %u byte aligned\n",
>  				    i, fb->pitches[i], stride_alignment);
> +			ret = -EINVAL;
>  			goto err_bo_framebuffer_fini;
>  		}
>  
> @@ -2287,6 +2291,7 @@ int intel_framebuffer_init(struct intel_framebuffer *intel_fb,
>  				drm_dbg_kms(display->drm,
>  					    "ccs aux plane %d pitch (%d) must be %d\n",
>  					    i, fb->pitches[i], ccs_aux_stride);
> +				ret = -EINVAL;
>  				goto err_bo_framebuffer_fini;
>  			}
>  		}

-- 
Jani Nikula, Intel

  reply	other threads:[~2025-11-10 11:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-07 18:11 [PATCH 0/9] drm/i915: Further drm_get_format_info() stuff Ville Syrjala
2025-11-07 18:11 ` [PATCH 1/9] drm/i915: Introduce intel_dumb_fb_max_stride() Ville Syrjala
2025-11-07 18:11 ` [PATCH 2/9] drm/i915: Pass drm_format_info into plane->max_stride() Ville Syrjala
2025-11-07 18:11 ` [PATCH 3/9] drm/i915: Populate fb->format accurately in BIOS FB readout Ville Syrjala
2025-11-07 18:11 ` [PATCH 4/9] drm/i915: Nuke intel_plane_config.tiling Ville Syrjala
2025-11-07 18:11 ` [PATCH 5/9] drm/i915/fb: Init 'ret' in each error branch in intel_framebuffer_init() Ville Syrjala
2025-11-10 11:07   ` Jani Nikula [this message]
2025-11-07 18:11 ` [PATCH 6/9] drm/i915/wm: Use drm_get_format_info() in SKL+ cursor DDB allocation Ville Syrjala
2025-11-10 11:08   ` Jani Nikula
2025-11-07 18:11 ` [PATCH 7/9] drm/i915: Use mode_config->cursor_width for " Ville Syrjala
2025-11-10 11:09   ` Jani Nikula
2025-11-07 18:11 ` [PATCH 8/9] drm/i915/cursor: Extract intel_cursor_mode_config_init() Ville Syrjala
2025-11-07 18:11 ` [PATCH 9/9] drm/i915/cursor: Initialize 845 vs 865 cursor size separately Ville Syrjala
2025-11-07 21:04 ` ✓ i915.CI.BAT: success for drm/i915: Further drm_get_format_info() stuff Patchwork
2025-11-08 20:43 ` ✗ i915.CI.Full: failure " Patchwork
2025-11-10 11:10 ` [PATCH 0/9] " Jani Nikula

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=af1c5d6c1b8fa5b7a7dd36714b187383a4435b03@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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