summaryrefslogtreecommitdiff
path: root/drivers/staging/rts5208/xd.c
diff options
context:
space:
mode:
authorBhaktipriya Shridhar <bhaktipriya96@gmail.com>2016-02-29 01:58:44 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-11 22:09:09 -0800
commitb242d05fa3ec5baf83f7a51c7c58757fcf36e321 (patch)
treeefcef955e122cf409fb63ffa7b6181cf34c01c57 /drivers/staging/rts5208/xd.c
parent7586170c84de561c7bf05dd0df0c4bf9786417d5 (diff)
staging: rts5208: Remove NULL test before vfree
vfree frees the virtually continuous memory area starting at addr. If addr is NULL, no operation is performed. So NULL test is not needed before vfree. This was done using Coccinelle: @@ expression x; @@ -if (x != NULL) vfree(x); @@ expression x; @@ -if (x != NULL) { vfree(x); x = NULL; -} Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rts5208/xd.c')
-rw-r--r--drivers/staging/rts5208/xd.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/drivers/staging/rts5208/xd.c b/drivers/staging/rts5208/xd.c
index fe84f757d575..fc1dfe0991d4 100644
--- a/drivers/staging/rts5208/xd.c
+++ b/drivers/staging/rts5208/xd.c
@@ -903,14 +903,10 @@ static inline void free_zone(struct zone_entry *zone)
zone->set_index = 0;
zone->get_index = 0;
zone->unused_blk_cnt = 0;
- if (zone->l2p_table) {
- vfree(zone->l2p_table);
- zone->l2p_table = NULL;
- }
- if (zone->free_table) {
- vfree(zone->free_table);
- zone->free_table = NULL;
- }
+ vfree(zone->l2p_table);
+ zone->l2p_table = NULL;
+ vfree(zone->free_table);
+ zone->free_table = NULL;
}
static void xd_set_unused_block(struct rtsx_chip *chip, u32 phy_blk)
@@ -1588,14 +1584,10 @@ static int xd_build_l2p_tbl(struct rtsx_chip *chip, int zone_no)
return STATUS_SUCCESS;
Build_Fail:
- if (zone->l2p_table) {
- vfree(zone->l2p_table);
- zone->l2p_table = NULL;
- }
- if (zone->free_table) {
- vfree(zone->free_table);
- zone->free_table = NULL;
- }
+ vfree(zone->l2p_table);
+ zone->l2p_table = NULL;
+ vfree(zone->free_table);
+ zone->free_table = NULL;
return STATUS_FAIL;
}
@@ -2251,14 +2243,10 @@ void xd_free_l2p_tbl(struct rtsx_chip *chip)
if (xd_card->zone != NULL) {
for (i = 0; i < xd_card->zone_cnt; i++) {
- if (xd_card->zone[i].l2p_table != NULL) {
- vfree(xd_card->zone[i].l2p_table);
- xd_card->zone[i].l2p_table = NULL;
- }
- if (xd_card->zone[i].free_table != NULL) {
- vfree(xd_card->zone[i].free_table);
- xd_card->zone[i].free_table = NULL;
- }
+ vfree(xd_card->zone[i].l2p_table);
+ xd_card->zone[i].l2p_table = NULL;
+ vfree(xd_card->zone[i].free_table);
+ xd_card->zone[i].free_table = NULL;
}
vfree(xd_card->zone);
xd_card->zone = NULL;