Skip to contentSkip to conversation

ALSA: ctxfi: Remove null check before kfree

PATCH Applied Himanshu Jha 2 participants 2 messages Aug 31, 2017 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: ctxfi: Remove null check before kfree

kfree on NULL pointer is a no-op and therefore checking is redundant.

---
 sound/pci/ctxfi/ctresource.c | 6 ++----
 sound/pci/ctxfi/ctsrc.c      | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)
sound/pci/ctxfi/ctresource.c +2 -4
index c5124c3..80c4d84 100644
@@ -258,10 +258,8 @@ int rsc_mgr_init(struct rsc_mgr *mgr, enum RSCTYP type,
 
 int rsc_mgr_uninit(struct rsc_mgr *mgr)
 {
-	if (NULL != mgr->rscs) {
-		kfree(mgr->rscs);
-		mgr->rscs = NULL;
-	}
+	kfree(mgr->rscs);
+	mgr->rscs = NULL;
 
 	if ((NULL != mgr->hw) && (NULL != mgr->ctrl_blk)) {
 		switch (mgr->type) {
sound/pci/ctxfi/ctsrc.c +2 -4
index a5a72df..bb4c9c3 100644
@@ -702,10 +702,8 @@ static int srcimp_rsc_init(struct srcimp *srcimp,
 
 static int srcimp_rsc_uninit(struct srcimp *srcimp)
 {
-	if (NULL != srcimp->imappers) {
-		kfree(srcimp->imappers);
-		srcimp->imappers = NULL;
-	}
+	kfree(srcimp->imappers);
+	srcimp->imappers = NULL;
 	srcimp->ops = NULL;
 	srcimp->mgr = NULL;
 	rsc_uninit(&srcimp->rsc);
Signature · 1 line
2.7.4