Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751683AbdHaPHA (ORCPT ); Thu, 31 Aug 2017 11:07:00 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:37086 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751011AbdHaPG6 (ORCPT ); Thu, 31 Aug 2017 11:06:58 -0400 X-Google-Smtp-Source: ADKCNb59dGb+7Ju6Y0Y9R3YHiLZuEFHuo6THcfa+1aOXLpijDSv1zNRY1ywxmzfxVj7eZ9tV0eMhKg== From: Himanshu Jha To: perex@perex.cz Cc: tiwai@suse.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Himanshu Jha Subject: [PATCH] ALSA: ctxfi: Remove null check before kfree Date: Thu, 31 Aug 2017 20:36:42 +0530 Message-Id: <1504192002-12105-1-git-send-email-himanshujha199640@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1267 Lines: 44 kfree on NULL pointer is a no-op and therefore checking is redundant. Signed-off-by: Himanshu Jha --- 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