From patchwork Tue Feb 3 14:10:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 5768791 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 404CBBF440 for ; Tue, 3 Feb 2015 14:11:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7195F20251 for ; Tue, 3 Feb 2015 14:11:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A58402014A for ; Tue, 3 Feb 2015 14:11:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755873AbbBCOLh (ORCPT ); Tue, 3 Feb 2015 09:11:37 -0500 Received: from mout.web.de ([212.227.15.14]:50467 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755808AbbBCOLg (ORCPT ); Tue, 3 Feb 2015 09:11:36 -0500 Received: from [192.168.1.2] ([78.49.19.127]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0MfYXz-1XzawO25M3-00P6w0; Tue, 03 Feb 2015 15:10:47 +0100 Message-ID: <54D0D6CC.1050708@users.sourceforge.net> Date: Tue, 03 Feb 2015 15:10:20 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Mauro Carvalho Chehab , Olli Salonen , linux-media@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH] [media] sp2: Delete an unnecessary check before the function call "kfree" References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> In-Reply-To: <5317A59D.4@users.sourceforge.net> X-Provags-ID: V03:K0:Ur4WLpTm50N1Tzst8G6TuxVgGhyn07WGe8Z6qHLevP/igPbsuH3 hhgB6IS8rsOFGCXLPcVmOb10ee72SpOIZ+08CcrPDYRwO2ZGCIYofwT+GIhz2ltNYAfhnUF vadbnXKp/VKoO5BgNIwvFhSMUfFRqcBQYlk8tI+RtwzR+sqQDiLvPCco/kRGobmg/6f1oRK 7/1UzkXm9PbtRnL2tQKDQ== X-UI-Out-Filterresults: notjunk:1; Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Tue, 3 Feb 2015 15:05:26 +0100 The kfree() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/media/dvb-frontends/sp2.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/dvb-frontends/sp2.c b/drivers/media/dvb-frontends/sp2.c index cc1ef96..8fd4276 100644 --- a/drivers/media/dvb-frontends/sp2.c +++ b/drivers/media/dvb-frontends/sp2.c @@ -413,11 +413,8 @@ static int sp2_remove(struct i2c_client *client) struct sp2 *s = i2c_get_clientdata(client); dev_dbg(&client->dev, "\n"); - sp2_exit(client); - if (s != NULL) - kfree(s); - + kfree(s); return 0; }