diff mbox

drm/i915/selftests: Potential uninitialized return in live_reset_whitelist()

Message ID 20180427140616.GC19583@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter April 27, 2018, 2:06 p.m. UTC
Smatch complains that "err" could be uninitialized at the end.  I don't
know the code well but that seems like a reasonable warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Ville Syrjälä April 27, 2018, 2:10 p.m. UTC | #1
On Fri, Apr 27, 2018 at 05:06:16PM +0300, Dan Carpenter wrote:
> Smatch complains that "err" could be uninitialized at the end.  I don't
> know the code well but that seems like a reasonable warning.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/gpu/drm/i915/selftests/intel_workarounds.c b/drivers/gpu/drm/i915/selftests/intel_workarounds.c
> index 5455b2626627..17444a3abbb9 100644
> --- a/drivers/gpu/drm/i915/selftests/intel_workarounds.c
> +++ b/drivers/gpu/drm/i915/selftests/intel_workarounds.c
> @@ -239,7 +239,7 @@ static int live_reset_whitelist(void *arg)
>  	struct intel_engine_cs *engine = i915->engine[RCS];
>  	struct i915_gpu_error *error = &i915->gpu_error;
>  	struct whitelist w;
> -	int err;
> +	int err = 0;
>  
>  	/* If we reset the gpu, we should not lose the RING_NONPRIV */

Looks like this is already fixed.

commit a3997159133d56e444f0c0f56ab1ae59863912a8
Author: Gustavo A. R. Silva <gustavo@embeddedor.com>
Date:   Tue Apr 24 08:15:45 2018 -0500

    drm/i915/selftests: Fix uninitialized variable
Chris Wilson April 27, 2018, 2:11 p.m. UTC | #2
Quoting Dan Carpenter (2018-04-27 15:06:16)
> Smatch complains that "err" could be uninitialized at the end.  I don't
> know the code well but that seems like a reasonable warning.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks for the report, Gustavo Silva already submitted the same fixup.

commit a3997159133d56e444f0c0f56ab1ae59863912a8
Author: Gustavo A. R. Silva <gustavo@embeddedor.com>
Date:   Tue Apr 24 08:15:45 2018 -0500

    drm/i915/selftests: Fix uninitialized variable
    
    There is a potential execution path in which variable err is
    returned without being properly initialized previously.
    
    Fix this by initializing variable err to 0.

Ta,
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/selftests/intel_workarounds.c b/drivers/gpu/drm/i915/selftests/intel_workarounds.c
index 5455b2626627..17444a3abbb9 100644
--- a/drivers/gpu/drm/i915/selftests/intel_workarounds.c
+++ b/drivers/gpu/drm/i915/selftests/intel_workarounds.c
@@ -239,7 +239,7 @@  static int live_reset_whitelist(void *arg)
 	struct intel_engine_cs *engine = i915->engine[RCS];
 	struct i915_gpu_error *error = &i915->gpu_error;
 	struct whitelist w;
-	int err;
+	int err = 0;
 
 	/* If we reset the gpu, we should not lose the RING_NONPRIV */