Am 05.02.2015 um 22:27 schrieb SF Markus Elfring:
> From: Markus Elfring <[email protected]>
> Date: Thu, 5 Feb 2015 22:23:48 +0100
> 
> The kfree() function tests whether its argument is NULL and then
> returns immediately. Thus the test around the call is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <[email protected]>
> ---
>  drivers/scsi/aic7xxx/aic7xxx_core.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c 
> b/drivers/scsi/aic7xxx/aic7xxx_core.c
> index 10172a3..98a5ed1 100644
> --- a/drivers/scsi/aic7xxx/aic7xxx_core.c
> +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
> @@ -2200,8 +2200,7 @@ ahc_free_tstate(struct ahc_softc *ahc, u_int scsi_id, 
> char channel, int force)
>       if (channel == 'B')
>               scsi_id += 8;
>       tstate = ahc->enabled_targets[scsi_id];
> -     if (tstate != NULL)
> -             kfree(tstate);
> +     kfree(tstate);
>       ahc->enabled_targets[scsi_id] = NULL;
>  }
>  #endif
> @@ -4482,8 +4481,7 @@ ahc_set_unit(struct ahc_softc *ahc, int unit)
>  void
>  ahc_set_name(struct ahc_softc *ahc, char *name)
>  {
> -     if (ahc->name != NULL)
> -             kfree(ahc->name);
> +     kfree(ahc->name);
>       ahc->name = name;
>  }
>  
> @@ -4550,10 +4548,8 @@ ahc_free(struct ahc_softc *ahc)
>               kfree(ahc->black_hole);
>       }
>  #endif
> -     if (ahc->name != NULL)
> -             kfree(ahc->name);
> -     if (ahc->seep_config != NULL)
> -             kfree(ahc->seep_config);
> +     kfree(ahc->name);
> +     kfree(ahc->seep_config);
>  #ifndef __FreeBSD__
>       kfree(ahc);
>  #endif
> @@ -4958,8 +4954,7 @@ ahc_fini_scbdata(struct ahc_softc *ahc)
>       case 0:
>               break;
>       }
> -     if (scb_data->scbarray != NULL)
> -             kfree(scb_data->scbarray);
> +     kfree(scb_data->scbarray);
>  }
>  
>  static void
> 

Would you like to integrate this update suggestion
into another source code repository?

Regards,
Markus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to