summaryrefslogtreecommitdiff
path: root/drivers/scsi/aic7xxx/aic7xxx_core.c
diff options
context:
space:
mode:
authorAlex Dewar <alex.dewar@gmx.co.uk>2020-04-03 19:47:11 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2020-04-24 19:48:48 +0300
commitd1ec20a55f6c8ce485fd298a015ec83d7e5326d8 (patch)
treebd22fe58b78b6d6a96a7bdbca11e36e64ec9003e /drivers/scsi/aic7xxx/aic7xxx_core.c
parent9cd7d494bd2b1fb53884a797b460b4f1741b82cc (diff)
downloadlinux-d1ec20a55f6c8ce485fd298a015ec83d7e5326d8.tar.xz
scsi: aic7xxx: Remove unnecessary NULL checks before kfree
There are a number of places in the aic7xxx driver where a NULL check is performed before a kfree(). However, kfree() already performs NULL checks so this is unnecessary. Remove the checks. Issue identified with Coccinelle. Link: https://lore.kernel.org/r/20200403164712.49579-1-alex.dewar@gmx.co.uk Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/aic7xxx/aic7xxx_core.c')
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_core.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 36a7ea1ba7da..3d4df906fa4f 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -2178,8 +2178,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
@@ -4453,8 +4452,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;
}
@@ -4515,10 +4513,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);
kfree(ahc);
return;
}
@@ -4927,8 +4923,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