* [PATCH] scsi: aic7xxx: remove NULL check before some freeing functions
@ 2020-04-18 9:59 Jason Yan
0 siblings, 0 replies; only message in thread
From: Jason Yan @ 2020-04-18 9:59 UTC (permalink / raw)
To: hare, jejb, martin.petersen, yanaijie, alex.dewar, linux-scsi,
linux-kernel
Cc: Hulk Robot
Fix the following coccicheck warning:
drivers/scsi/aic7xxx/aic7xxx_core.c:4931:2-7: WARNING: NULL check before
some freeing functions is not needed.
drivers/scsi/aic7xxx/aic7xxx_core.c:4519:2-7: WARNING: NULL check before
some freeing functions is not needed.
drivers/scsi/aic7xxx/aic7xxx_core.c:4521:2-7: WARNING: NULL check before
some freeing functions is not needed.
drivers/scsi/aic7xxx/aic7xxx_core.c:2182:2-7: WARNING: NULL check before
some freeing functions is not needed.
drivers/scsi/aic7xxx/aic7xxx_core.c:4457:2-7: WARNING: NULL check before
some freeing functions is not needed.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
---
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 84fc499cb1e6..5a10feea17fe 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
--
2.21.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-04-18 9:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-18 9:59 [PATCH] scsi: aic7xxx: remove NULL check before some freeing functions Jason Yan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).