linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/sun4i: Fix a return value in case of error
@ 2016-11-18 18:18 Christophe JAILLET
  2016-11-22 15:49 ` Maxime Ripard
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2016-11-18 18:18 UTC (permalink / raw)
  To: maxime.ripard, airlied, wens
  Cc: dri-devel, linux-arm-kernel, linux-kernel, kernel-janitors,
	Christophe JAILLET

If 'sun4i_backend_drm_format_to_layer()' does not return 0, then 'val' is
left unmodified.
As it is not initialized either, the return value can be anything.

It is likely that returning the error code was expected here.

As the only caller of 'sun4i_backend_update_layer_formats()' does not check
the return value, this fix is purely theorical.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/gpu/drm/sun4i/sun4i_backend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c
index 7eb2a965f83d..f724b8047bae 100644
--- a/drivers/gpu/drm/sun4i/sun4i_backend.c
+++ b/drivers/gpu/drm/sun4i/sun4i_backend.c
@@ -192,7 +192,7 @@ int sun4i_backend_update_layer_formats(struct sun4i_backend *backend,
 	ret = sun4i_backend_drm_format_to_layer(plane, fb->pixel_format, &val);
 	if (ret) {
 		DRM_DEBUG_DRIVER("Invalid format\n");
-		return val;
+		return ret;
 	}
 
 	regmap_update_bits(backend->regs, SUN4I_BACKEND_ATTCTL_REG1(layer),
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/sun4i: Fix a return value in case of error
  2016-11-18 18:18 [PATCH] drm/sun4i: Fix a return value in case of error Christophe JAILLET
@ 2016-11-22 15:49 ` Maxime Ripard
  0 siblings, 0 replies; 2+ messages in thread
From: Maxime Ripard @ 2016-11-22 15:49 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: airlied, wens, dri-devel, linux-arm-kernel, linux-kernel,
	kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 644 bytes --]

On Fri, Nov 18, 2016 at 07:18:47PM +0100, Christophe JAILLET wrote:
> If 'sun4i_backend_drm_format_to_layer()' does not return 0, then 'val' is
> left unmodified.
> As it is not initialized either, the return value can be anything.
> 
> It is likely that returning the error code was expected here.
> 
> As the only caller of 'sun4i_backend_update_layer_formats()' does not check
> the return value, this fix is purely theorical.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Applied, thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-22 15:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-18 18:18 [PATCH] drm/sun4i: Fix a return value in case of error Christophe JAILLET
2016-11-22 15:49 ` Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).