Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1724312 > unrolled thread

[PATCH] ALSA: ctxfi: Remove null check before kfree

Started byHimanshu Jha <himanshujha199640@gmail.com>
First post2017-08-31 17:10 +0200
Last post2017-08-31 20:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ALSA: ctxfi: Remove null check before kfree Himanshu Jha <himanshujha199640@gmail.com> - 2017-08-31 17:10 +0200
    Re: [PATCH] ALSA: ctxfi: Remove null check before kfree Takashi Iwai <tiwai@suse.de> - 2017-08-31 20:20 +0200

#1724312 — [PATCH] ALSA: ctxfi: Remove null check before kfree

FromHimanshu Jha <himanshujha199640@gmail.com>
Date2017-08-31 17:10 +0200
Subject[PATCH] ALSA: ctxfi: Remove null check before kfree
Message-ID<ukzgu-7dy-21@gated-at.bofh.it>
kfree on NULL pointer is a no-op and therefore checking is redundant.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---
 sound/pci/ctxfi/ctresource.c | 6 ++----
 sound/pci/ctxfi/ctsrc.c      | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/sound/pci/ctxfi/ctresource.c b/sound/pci/ctxfi/ctresource.c
index c5124c3..80c4d84 100644
--- a/sound/pci/ctxfi/ctresource.c
+++ b/sound/pci/ctxfi/ctresource.c
@@ -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) {
diff --git a/sound/pci/ctxfi/ctsrc.c b/sound/pci/ctxfi/ctsrc.c
index a5a72df..bb4c9c3 100644
--- a/sound/pci/ctxfi/ctsrc.c
+++ b/sound/pci/ctxfi/ctsrc.c
@@ -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);
-- 
2.7.4

[toc] | [next] | [standalone]


#1724476

FromTakashi Iwai <tiwai@suse.de>
Date2017-08-31 20:20 +0200
Message-ID<ukCem-ER-5@gated-at.bofh.it>
In reply to#1724312
On Thu, 31 Aug 2017 17:06:42 +0200,
Himanshu Jha wrote:
> 
> kfree on NULL pointer is a no-op and therefore checking is redundant.
> 
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>

Applied, thanks.


Takashi

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web