From patchwork Thu Aug 31 19:58:59 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: 9932779 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 D984760362 for ; Thu, 31 Aug 2017 19:59:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCEDF28A32 for ; Thu, 31 Aug 2017 19:59:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1FD428A3B; Thu, 31 Aug 2017 19:59:08 +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=ham 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 78A5E28A32 for ; Thu, 31 Aug 2017 19:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751242AbdHaT7H (ORCPT ); Thu, 31 Aug 2017 15:59:07 -0400 Received: from mout.web.de ([212.227.17.12]:50689 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751086AbdHaT7G (ORCPT ); Thu, 31 Aug 2017 15:59:06 -0400 Received: from [192.168.1.2] ([77.181.81.131]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LshKH-1dLDEi0KN7-012IKH; Thu, 31 Aug 2017 21:59:01 +0200 Subject: [PATCH 3/3] [media] mb86a20s: Delete a jump target in mb86a20s_attach() From: SF Markus Elfring To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Max Kellermann , Nicolas Iooss Cc: LKML , kernel-janitors@vger.kernel.org References: <9571ee6c-5137-15f4-4cdb-9f03b5cb9268@users.sourceforge.net> Message-ID: <6b7fbd7b-f25d-25c0-5473-41c11b308349@users.sourceforge.net> Date: Thu, 31 Aug 2017 21:58:59 +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: <9571ee6c-5137-15f4-4cdb-9f03b5cb9268@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:SV07ISq+xNhxqZwBu6ntdx91XDeQ4WmLpR/wB3oRFqLkfcKTIlG vduacPD1htH+5ZiotN31Sdtx0x63gaugMI6XpLBlyLz+ojcwrPzCoJSm6LCZ3Xv6CWWwZ0x o8g4fZjuTt5dlI/bTqxX//BCIHOJMMEV0ToX0Q1AWhdQDjzAyJHzviZZgHPTmm+IkxXGLe1 ytGnOET83Wkdllodo0VPw== X-UI-Out-Filterresults: notjunk:1; V01:K0:bgx7/SShOAs=:CT/qP/+fi9LZWCsbz6RQ3j GV2WseFtupGbVmYfvzOGhUKmIB4fnpYSwWBrYnqRu2f6/UIsr9Fgw2N6Uu8B0rWFzUcING3C/ qWIoXZxZ7rNtmR7k6MKMhYg1V2+QWxWZpqk8+fKW3uLZGF8DMla1s+wmup9coEeH4OGBcKgTV T6Gwd4cypnVUi/6+14RP697pYc3YvWRDXll4DdXhPH8ZVzxYzJhcCDGaGCKFxKfiKvBRshcb3 B4YImNrI4TJwOv6wRCq1Z+inzfzaLc1+GDcLKlqq/X1+pzZslDpZMUqsfv6OE9dYq5yh0GvEn AYm6u/4RK4tT/HDojJy1sTrKemML6keYvO7rIovxMSlPrmoGNWoWDK2bBwVYc3HgkhaDzH2p5 AOEMFDT0wTwoU+Y45CQUdXL2MnoLN1u761DBDhN1XpDWtAM5J/P8QGKi8eg3qvYTiIUCiwAg/ dr7M7LfWQRteKfx6imvwPHup8RwijR/JTMcrYjkRKVeqTG/vyc0QyfeFlYY/dzFNZG/GZL/oQ lANs4BF7M1oOGbmPM5ttaGvar3ZkZuve9kBCTFvkxUy9uqe9CWXPfS0VLhOD7/iwDGOiJocqe l12qiNimOvvaKfMhqRTx1BnsbPxPKph1Z5q4KnepLqU41InsoMY6AXtpmibmV6DTU94q/DXFz qczUV+m0vaxpo2PjImxha3J3W1RGNwzGsfuqSTuioLx5b+ejCtOfbt4j+zCiFxviJldevxsLZ npc/y72XSqU80Fvnbl4EZODLMW8bmsKTaMwVAeDQQkHzgmsvuRo11DAzFG+6UCqyEclGblYA5 9Y9PQDz1f94ATrABlTVQZp2NCQ+UJC6UdpGE/3nQtShs/vCRaE= 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: Thu, 31 Aug 2017 21:34:58 +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. * Adjust a condition check. * Delete the jump target "error" which became unnecessary with this refactoring. Signed-off-by: Markus Elfring --- drivers/media/dvb-frontends/mb86a20s.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c index ba7a433dd424..bdaf9d235fed 100644 --- a/drivers/media/dvb-frontends/mb86a20s.c +++ b/drivers/media/dvb-frontends/mb86a20s.c @@ -2073,7 +2073,7 @@ struct dvb_frontend *mb86a20s_attach(const struct mb86a20s_config *config, /* allocate memory for the internal state */ state = kzalloc(sizeof(*state), GFP_KERNEL); if (!state) - goto error; + return NULL; /* setup the state */ state->config = config; @@ -2086,22 +2086,16 @@ struct dvb_frontend *mb86a20s_attach(const struct mb86a20s_config *config, /* Check if it is a mb86a20s frontend */ rev = mb86a20s_readreg(state, 0); - - if (rev == 0x13) { - dev_info(&i2c->dev, - "Detected a Fujitsu mb86a20s frontend\n"); - } else { + if (rev != 0x13) { + kfree(state); dev_dbg(&i2c->dev, "Frontend revision %d is unknown - aborting.\n", rev); - goto error; + return NULL; } + dev_info(&i2c->dev, "Detected a Fujitsu mb86a20s frontend\n"); return &state->frontend; - -error: - kfree(state); - return NULL; } EXPORT_SYMBOL(mb86a20s_attach);