From patchwork Wed Aug 30 20:24:26 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: 9930735 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 7B141603B4 for ; Wed, 30 Aug 2017 20:25:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F80A287A2 for ; Wed, 30 Aug 2017 20:25:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63BBB287B1; Wed, 30 Aug 2017 20:25:32 +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 98986287A2 for ; Wed, 30 Aug 2017 20:25:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751675AbdH3UYj (ORCPT ); Wed, 30 Aug 2017 16:24:39 -0400 Received: from mout.web.de ([217.72.192.78]:63977 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751264AbdH3UYh (ORCPT ); Wed, 30 Aug 2017 16:24:37 -0400 Received: from [192.168.1.2] ([77.182.113.36]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Mb8wp-1e6BSd1utX-00Kl46; Wed, 30 Aug 2017 22:24:32 +0200 Subject: [PATCH 4/4] [media] ds3000: Delete jump targets in ds3000_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: <6845c215-eeb8-5286-6049-ea4befb645ae@users.sourceforge.net> Date: Wed, 30 Aug 2017 22:24:26 +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:JOqYxpuYSnV7RGo5a8hETi4D76vWzGJqcatIu7Rqgj8e+Zx55hg O9k/VrLZpevzCsu30aCL7f4sbKUj6Z8VN0QHpFuxIjbtfr4dbMQKfuRWbxv7sIHSVW6TJB5 AQg3q9kKsSVkSxpD4NV7PT0rtoFGNQo7/vEo+fs8YgqvfZHAYtO6nvUht1fatKXa1Ik1aRb JGxp+2wCuvPss7U3jdBcg== X-UI-Out-Filterresults: notjunk:1; V01:K0:GBcdNP5JgOc=:TqmX08rrWCNuiX8rsBYjK2 FCYHEVG77siijrQtC1IVVrxYEbjIXeiJ/UFjNcjEQ8n1xhzhFTnDPnw5hABrQCBe1eC4fyUB7 iI/gvpHuUVm/4JXfLBbWPvQw7skbDl2nouWN9nWCH0cpcjVjqRhXy65+UxWFs7lYVPCnrrIRb S3xyx+uXwP5CTScvnBFBZapbf0oqwlqYOzkfsfBVq7vIONj2JLv8bv3O/EC1BAx0Mp4B9p512 Q6Wl4OV2BiJICd5LaXbv72Ke3r5dFNIgQOtDsMAigh+qdNQ9boi8yI4+Fyf4DXGD8uS/FRQXu JJgjLs2hU3heN6gdJdj/7KktLLoQ4hpbmSg0fBrsR+bKc/WYCMgqdr4im0qkAmFD0c/Z7DUUW Gio8+u4OEZenboEwL+y6rC4YlTG3rWoohBoPl5rUIeTgcYxTDkteS2jn5WNoKtoNPmIy8RH/Q L6kgDO0tuDcvXvS/gRv8Ht9I9KnHCjPAOjwUCnFfutHWnZ+tkCpOljKNE1Z7kfay6q72Yuxeo FZX4mlk11bOgdcVgzskVvms4UCZEQ8NS9pCYZAeRh4INaq/mvtwnAtVBPN0RczhW/pT2DXT8G ZfBqCIIvglPuFa4qvHeQ0ULzyL7Sb5tlJkFQuirLtM4J8KgH4Uzq/GFE7xGM72+/tT1ZR1b1P v3ilxU5a6HdRdXq5HQx9fy9v1v1oZTWsvbGQLOzWVlhkVKEg3VSSY4tzthDCCNKLs/x4f9kRo PT57A5ZsWA28gdQ6HVhyxh6JsNXk5JhQ1wq+HpjqprZDZGz93NjBvcg0VTuL1u3j6Z8wLbikv R5EckvTPFmYuZUzPR5qgV0QeQwJnRHKD2LkPXPCcEAgjXdtJa8= 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 22:02:54 +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/ds3000.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/media/dvb-frontends/ds3000.c b/drivers/media/dvb-frontends/ds3000.c index 3e347d03acb3..bd4f8278c906 100644 --- a/drivers/media/dvb-frontends/ds3000.c +++ b/drivers/media/dvb-frontends/ds3000.c @@ -841,7 +841,7 @@ struct dvb_frontend *ds3000_attach(const struct ds3000_config *config, /* allocate memory for the internal state */ state = kzalloc(sizeof(*state), GFP_KERNEL); if (!state) - goto error2; + return NULL; state->config = config; state->i2c = i2c; @@ -850,8 +850,9 @@ struct dvb_frontend *ds3000_attach(const struct ds3000_config *config, /* check if the demod is present */ ret = ds3000_readreg(state, 0x00) & 0xfe; if (ret != 0xe0) { + kfree(state); printk(KERN_ERR "Invalid probe, probably not a DS3000\n"); - goto error3; + return NULL; } printk(KERN_INFO "DS3000 chip version: %d.%d attached.\n", @@ -869,11 +870,6 @@ struct dvb_frontend *ds3000_attach(const struct ds3000_config *config, */ ds3000_set_voltage(&state->frontend, SEC_VOLTAGE_OFF); return &state->frontend; - -error3: - kfree(state); -error2: - return NULL; } EXPORT_SYMBOL(ds3000_attach);