diff mbox

drm/i915: fix simple_return.cocci warnings

Message ID 20150327112635.GA178369@athens (mailing list archive)
State New, archived
Headers show

Commit Message

Fengguang Wu March 27, 2015, 11:26 a.m. UTC
drivers/gpu/drm/i915/i915_gem_gtt.c:1349:1-4: WARNING: end returns can be simpified and declaration on line 1347 can be dropped

 Simplify a trivial if-return sequence.  Possibly combine with a
 preceding function call.
Generated by: scripts/coccinelle/misc/simple_return.cocci

CC: Michel Thierry <michel.thierry@intel.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 i915_gem_gtt.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Michel Thierry March 27, 2015, 12:04 p.m. UTC | #1
On 3/27/2015 11:26 AM, kbuild test robot wrote:
> drivers/gpu/drm/i915/i915_gem_gtt.c:1349:1-4: WARNING: end returns can be simpified and declaration on line 1347 can be dropped
>
>   Simplify a trivial if-return sequence.  Possibly combine with a
>   preceding function call.
> Generated by: scripts/coccinelle/misc/simple_return.cocci
>
> CC: Michel Thierry <michel.thierry@intel.com>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
>
>   i915_gem_gtt.c |    8 +-------
>   1 file changed, 1 insertion(+), 7 deletions(-)
>
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -1344,13 +1344,7 @@ err_out:
>   
>   static int gen6_ppgtt_alloc(struct i915_hw_ppgtt *ppgtt)
>   {
> -	int ret;
> -
> -	ret = gen6_ppgtt_allocate_page_directories(ppgtt);
> -	if (ret)
> -		return ret;
> -
> -	return 0;
> +	return gen6_ppgtt_allocate_page_directories(ppgtt);
>   }
>   
>   static void gen6_scratch_va_range(struct i915_hw_ppgtt *ppgtt,

Thanks,

Reviewed-by: Michel Thierry <michel.thierry@intel.com>
Daniel Vetter March 27, 2015, 1:49 p.m. UTC | #2
On Fri, Mar 27, 2015 at 07:26:35PM +0800, kbuild test robot wrote:
> drivers/gpu/drm/i915/i915_gem_gtt.c:1349:1-4: WARNING: end returns can be simpified and declaration on line 1347 can be dropped
> 
>  Simplify a trivial if-return sequence.  Possibly combine with a
>  preceding function call.
> Generated by: scripts/coccinelle/misc/simple_return.cocci
> 
> CC: Michel Thierry <michel.thierry@intel.com>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>

Queued for -next, thanks for the patch.
-Daniel

> ---
> 
>  i915_gem_gtt.c |    8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -1344,13 +1344,7 @@ err_out:
>  
>  static int gen6_ppgtt_alloc(struct i915_hw_ppgtt *ppgtt)
>  {
> -	int ret;
> -
> -	ret = gen6_ppgtt_allocate_page_directories(ppgtt);
> -	if (ret)
> -		return ret;
> -
> -	return 0;
> +	return gen6_ppgtt_allocate_page_directories(ppgtt);
>  }
>  
>  static void gen6_scratch_va_range(struct i915_hw_ppgtt *ppgtt,
diff mbox

Patch

--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1344,13 +1344,7 @@  err_out:
 
 static int gen6_ppgtt_alloc(struct i915_hw_ppgtt *ppgtt)
 {
-	int ret;
-
-	ret = gen6_ppgtt_allocate_page_directories(ppgtt);
-	if (ret)
-		return ret;
-
-	return 0;
+	return gen6_ppgtt_allocate_page_directories(ppgtt);
 }
 
 static void gen6_scratch_va_range(struct i915_hw_ppgtt *ppgtt,