From patchwork Wed Aug 30 07:24:10 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: 9928815 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 DB60D6022E for ; Wed, 30 Aug 2017 07:24:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDEC02041F for ; Wed, 30 Aug 2017 07:24:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C281326247; Wed, 30 Aug 2017 07:24:30 +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 8655B2041F for ; Wed, 30 Aug 2017 07:24:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751295AbdH3HYR (ORCPT ); Wed, 30 Aug 2017 03:24:17 -0400 Received: from mout.web.de ([212.227.17.12]:59293 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750839AbdH3HYQ (ORCPT ); Wed, 30 Aug 2017 03:24:16 -0400 Received: from [192.168.1.2] ([77.182.113.36]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MXHbN-1dzFaI0ELd-00WF0f; Wed, 30 Aug 2017 09:24:11 +0200 Subject: [PATCH 6/6] [media] cx24116: Delete jump targets in cx24116_attach() From: SF Markus Elfring To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Max Kellermann Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <5f395fa8-c931-b074-090a-9c97526834ad@users.sourceforge.net> Date: Wed, 30 Aug 2017 09:24:10 +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: Content-Language: en-GB X-Provags-ID: V03:K0:OHfNZ3Kg39ytSVQPxFVMSZw37QCNap9Q5SVMWDKfmhbSh+1dbNx S84Bf1an1Cpi2P6X0DkaEH6Ac5y/bEkdM021HO46ggx/qDultfNieVfwKria5z/HoK6ZLm1 tNCDQp3n1uNPCw1/Kb6wAf53ABHmbGG7q5kl3TZcVaaU9F9DQxDwtaNuo4TW2bM5KAqy6Fg +g21nOmn1z2N+qN+5rDuQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:+EWKy0sWwc4=:V4qjqqEK3CnGsdO+snOon5 EjOQOER7h2JMe0o3hYg6wBIau+VfA2hlAhyQfcchCudOLC+J5SAFSlyCq53DTf56E9WwqtzvE n0atIuNDphGhQeCuFGkZaN0l9dytgiKvxt+YBZsc5yb2w6bJaLgKxdBANfY3tXCKPh4WSPN7m YvFUSbaAHAa58mAJKQr4NPY/u/Ceu9SmIem63Hgnb1Rrg/yuJWMf6qBYuOYdYYHO18y61Fl2H cy3mt/+2J1//jAQyFpm9aUe3/XW0wSb/wgRYvX7dgGYiDBNBvgHgpRXmctDsxJT2gDSURf8Rl 0FK/sl/H49wBY4HU5dn2G3JOQaKaaPvPR8qIjcdjqUhSSxKC4wLqXYst7rSknXm4tu7GzP553 r4oc/8IXwrCNz/RXx/OdVJT9BW3NOErW1yllnvF1GCSPIdN9E8Monl5H4HP3ysil1QOm3uQtG XufA5/rerlSG8S7qH8Ak0aMMRJySuhfmPTj9no9OMXG8eHI/sfb19FGZiZQU0lFNWAsXZqNEp a3fiHwMsL1cEhYPLWDmCToyxqCkvLECls3gkJEy6AQ+CAwIDRdX9Gc3pF0DgBfgBQOgS+NKRy ioLo9Ktz7Lr9lH45CUawHQ6gp3CgJK71jKMkkDxonbK7ufJwKUdJwd/VRgrQ/oMenxlNsDb7I acFRJ+hpGlgG41VCchVerzvLtzqf4zKYYhSDVsbkiuaSh90SI437+0lvLIzbd9nw5cY4Piwes /+h5im/jdSXUQlMNWqQPgqkELx21mUiOym6au8YBQTOwa3Jw7+SKJvZQHmyHkIOznTluu3y9P SXf27g4R6c3Uzzoc72S9dOB+Y5T2hF8xsDzpGBDPl9M/je/FBQ= 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: Wed, 30 Aug 2017 08:44:29 +0200 * Return directly after a call of the function "kzalloc" failed at the beginning. * Move a bit of exception handling code into an if branch. * Delete two jump targets which became unnecessary with this refactoring. Signed-off-by: Markus Elfring --- drivers/media/dvb-frontends/cx24116.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/media/dvb-frontends/cx24116.c b/drivers/media/dvb-frontends/cx24116.c index 902a60d2e1b5..8fb3f095e21c 100644 --- a/drivers/media/dvb-frontends/cx24116.c +++ b/drivers/media/dvb-frontends/cx24116.c @@ -1125,7 +1125,7 @@ struct dvb_frontend *cx24116_attach(const struct cx24116_config *config, /* allocate memory for the internal state */ state = kzalloc(sizeof(*state), GFP_KERNEL); if (state == NULL) - goto error1; + return NULL; state->config = config; state->i2c = i2c; @@ -1134,8 +1134,9 @@ struct dvb_frontend *cx24116_attach(const struct cx24116_config *config, ret = (cx24116_readreg(state, 0xFF) << 8) | cx24116_readreg(state, 0xFE); if (ret != 0x0501) { + kfree(state); printk(KERN_INFO "Invalid probe, probably not a CX24116 device\n"); - goto error2; + return NULL; } /* create dvb_frontend */ @@ -1143,9 +1144,6 @@ struct dvb_frontend *cx24116_attach(const struct cx24116_config *config, sizeof(struct dvb_frontend_ops)); state->frontend.demodulator_priv = state; return &state->frontend; - -error2: kfree(state); -error1: return NULL; } EXPORT_SYMBOL(cx24116_attach);