All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] drm/atomic: fix an error code in mode_fixup()
@ 2017-02-07 23:46 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-02-07 23:46 UTC (permalink / raw)
  To: Daniel Vetter, Thierry Reding; +Cc: kernel-janitors, dri-devel

Having "ret" be a bool type works for everything except
ret = funcs->atomic_check().  The other functions all return zero on
error but ->atomic_check() returns negative error codes.  We want to
propagate the error code but instead we return 1.

I found this bug with static analysis and I don't know if it affects
run time.

Fixes: 4cd4df8080a3 ("drm/atomic: Add ->atomic_check() to encoder helpers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 9a08445a7a7a..01d936b7be43 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -369,7 +369,7 @@ mode_fixup(struct drm_atomic_state *state)
 	struct drm_connector *connector;
 	struct drm_connector_state *conn_state;
 	int i;
-	bool ret;
+	int ret;
 
 	for_each_crtc_in_state(state, crtc, crtc_state, i) {
 		if (!crtc_state->mode_changed &&

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

* [patch] drm/atomic: fix an error code in mode_fixup()
@ 2017-02-07 23:46 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-02-07 23:46 UTC (permalink / raw)
  To: Daniel Vetter, Thierry Reding; +Cc: kernel-janitors, dri-devel

Having "ret" be a bool type works for everything except
ret = funcs->atomic_check().  The other functions all return zero on
error but ->atomic_check() returns negative error codes.  We want to
propagate the error code but instead we return 1.

I found this bug with static analysis and I don't know if it affects
run time.

Fixes: 4cd4df8080a3 ("drm/atomic: Add ->atomic_check() to encoder helpers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 9a08445a7a7a..01d936b7be43 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -369,7 +369,7 @@ mode_fixup(struct drm_atomic_state *state)
 	struct drm_connector *connector;
 	struct drm_connector_state *conn_state;
 	int i;
-	bool ret;
+	int ret;
 
 	for_each_crtc_in_state(state, crtc, crtc_state, i) {
 		if (!crtc_state->mode_changed &&
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [patch] drm/atomic: fix an error code in mode_fixup()
  2017-02-07 23:46 ` Dan Carpenter
@ 2017-02-08  8:49   ` Daniel Vetter
  -1 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2017-02-08  8:49 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Daniel Vetter, Thierry Reding, kernel-janitors, dri-devel

On Wed, Feb 08, 2017 at 02:46:01AM +0300, Dan Carpenter wrote:
> Having "ret" be a bool type works for everything except
> ret = funcs->atomic_check().  The other functions all return zero on
> error but ->atomic_check() returns negative error codes.  We want to
> propagate the error code but instead we return 1.
> 
> I found this bug with static analysis and I don't know if it affects
> run time.
> 
> Fixes: 4cd4df8080a3 ("drm/atomic: Add ->atomic_check() to encoder helpers")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied to drm-misc for 4.11, thanks.
-Daniel

> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 9a08445a7a7a..01d936b7be43 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -369,7 +369,7 @@ mode_fixup(struct drm_atomic_state *state)
>  	struct drm_connector *connector;
>  	struct drm_connector_state *conn_state;
>  	int i;
> -	bool ret;
> +	int ret;
>  
>  	for_each_crtc_in_state(state, crtc, crtc_state, i) {
>  		if (!crtc_state->mode_changed &&
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [patch] drm/atomic: fix an error code in mode_fixup()
@ 2017-02-08  8:49   ` Daniel Vetter
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2017-02-08  8:49 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Daniel Vetter, Thierry Reding, kernel-janitors, dri-devel

On Wed, Feb 08, 2017 at 02:46:01AM +0300, Dan Carpenter wrote:
> Having "ret" be a bool type works for everything except
> ret = funcs->atomic_check().  The other functions all return zero on
> error but ->atomic_check() returns negative error codes.  We want to
> propagate the error code but instead we return 1.
> 
> I found this bug with static analysis and I don't know if it affects
> run time.
> 
> Fixes: 4cd4df8080a3 ("drm/atomic: Add ->atomic_check() to encoder helpers")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied to drm-misc for 4.11, thanks.
-Daniel

> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 9a08445a7a7a..01d936b7be43 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -369,7 +369,7 @@ mode_fixup(struct drm_atomic_state *state)
>  	struct drm_connector *connector;
>  	struct drm_connector_state *conn_state;
>  	int i;
> -	bool ret;
> +	int ret;
>  
>  	for_each_crtc_in_state(state, crtc, crtc_state, i) {
>  		if (!crtc_state->mode_changed &&
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2017-02-08  8:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07 23:46 [patch] drm/atomic: fix an error code in mode_fixup() Dan Carpenter
2017-02-07 23:46 ` Dan Carpenter
2017-02-08  8:49 ` Daniel Vetter
2017-02-08  8:49   ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.