From patchwork Fri Sep 1 19:44:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9935219 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C9AAA6038C for ; Fri, 1 Sep 2017 19:45:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAA7C27FAE for ; Fri, 1 Sep 2017 19:45:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE3E02818A; Fri, 1 Sep 2017 19:45:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 753AA27FAE for ; Fri, 1 Sep 2017 19:45:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752406AbdIATo6 (ORCPT ); Fri, 1 Sep 2017 15:44:58 -0400 Received: from mout.web.de ([212.227.15.4]:60336 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752284AbdIATo5 (ORCPT ); Fri, 1 Sep 2017 15:44:57 -0400 Received: from [192.168.1.2] ([77.182.57.191]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M2dgj-1dX1wJ2o4L-00sL2t; Fri, 01 Sep 2017 21:44:46 +0200 Subject: [PATCH 3/4] [media] sp2: Adjust a jump target in sp2_probe() From: SF Markus Elfring To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Olli Salonen Cc: LKML , kernel-janitors@vger.kernel.org References: <6142ca34-fcda-f2b6-bc35-dbbde0d34378@users.sourceforge.net> Message-ID: <88ff94f8-ee01-7a11-f98e-92b3944dc930@users.sourceforge.net> Date: Fri, 1 Sep 2017 21:44:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <6142ca34-fcda-f2b6-bc35-dbbde0d34378@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:RjZcJ3JPkye8pGR18MRv1DkNcpEUmVhg8PvC5hzJnjRx/l4EtFw ihTE/3cDT7bCE4CluAaZ9b0vEvihPTHdqk0dBPPuh4mEsu/SmzccHIRLku6oooMMY22CI7Y uq1wRGg+8Yk1k39JGrewafZV7XGgGhsW1aCW7epsG6jYk1Q2tv4BWv/05AaekX7AQWtoqUj RlOGmjso3DKKfsz0gNLRA== X-UI-Out-Filterresults: notjunk:1; V01:K0:R8b0rcJqZQg=:F+1s8wRjbUpFOvwamEFCsc jjr3TEUJnYj9EjRpfNEnl+G/0apuzmVDjUqfNhO/Vl7FEL1mcpAIWdTZkFo9IWc+nbk3VO7Uz eFW3cbWjL6omMJE1GmyCsPBMdUHMJOyp4hkIpiN6mjGKkPyZ2qUPCiBwn+xL0+v/fDAILpK07 1jrKapTLx8UcuBR2SVHM56mJARKRHA3z2uX4Sopmk6E6hQFV+1dccYTU7wwZDepTCgoPI/Q06 rU908g8dV3vQSGxRgb6T32JNqQnWpSJObrwo7X/0VnVxw7QzzX1a2JkzaeFDntGvD+50WFgu9 s2lUkwRSsEySQkZRE84EjpnA3f+mGO2DHkS5X+VQS3r6vqnfrGYLlR08BLnj2WYdTsqeHku5p sGBBq7L+JvtbdjIw1WkRDRu0NupuBf47eRBvxJ+U0n33RXooKjXu65dxxraygPHahUeAcvL/3 DOcNb0AI1gh2hQ1VnhrGNNRbMPZjlGXAuTyPO6u2HsU9SGDyOGPH5Lx784V7FxxVr/AO+aN8r er3HqjKpO/H84YcIS3gKcv5mSK79gah2nNoq7pKW69Jc5rT9S/S3NZhInTSZlKj9J7lHN8Pu8 7wWfpDOxAljzwLe0QTOluDGYOpwf0fSneqC35iNLRb2aS9GToS1bwgbAFVRKotR3plhg81KXX X9TXFmsYyOMeDnCC5mOZRxj1kFq04hxXztSjMUzXa1FGxiQhRlzfHvqnTtKcb1NL6AsC2IdnC DbXxepUZV4v0QTfnQGXSE3OekEFbEK8VGPyEhNobGrOjXHekBopJtgpZxTWhK96NJy35muxyD WXKxWhCVb1wxf6asH3rZZ06Zv5CHq2IswCs3gq0oFVgzyw9z0U= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Fri, 1 Sep 2017 21:08:38 +0200 * Adjust a jump target so that a null pointer will not be passed to a call of the function "kfree". * Move this function call into an if branch. Signed-off-by: Markus Elfring --- drivers/media/dvb-frontends/sp2.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/media/dvb-frontends/sp2.c b/drivers/media/dvb-frontends/sp2.c index dd556012ceb6..b2a7a54174ae 100644 --- a/drivers/media/dvb-frontends/sp2.c +++ b/drivers/media/dvb-frontends/sp2.c @@ -384,7 +384,7 @@ static int sp2_probe(struct i2c_client *client, s = kzalloc(sizeof(*s), GFP_KERNEL); if (!s) { ret = -ENOMEM; - goto err; + goto report_failure; } s->client = client; @@ -395,15 +395,16 @@ static int sp2_probe(struct i2c_client *client, i2c_set_clientdata(client, s); ret = sp2_init(s); - if (ret) - goto err; + if (ret) { + kfree(s); + goto report_failure; + } dev_info(&s->client->dev, "CIMaX SP2 successfully attached\n"); return 0; -err: - dev_dbg(&client->dev, "init failed=%d\n", ret); - kfree(s); +report_failure: + dev_dbg(&client->dev, "init failed=%d\n", ret); return ret; }