From patchwork Wed Aug 30 07:20:12 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: 9928797 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 B2A8F6022E for ; Wed, 30 Aug 2017 07:20:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A31C827CEA for ; Wed, 30 Aug 2017 07:20:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97FEC27E5A; Wed, 30 Aug 2017 07:20:36 +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 60FA527CEA for ; Wed, 30 Aug 2017 07:20:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751329AbdH3HUX (ORCPT ); Wed, 30 Aug 2017 03:20:23 -0400 Received: from mout.web.de ([217.72.192.78]:50677 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751186AbdH3HUW (ORCPT ); Wed, 30 Aug 2017 03:20:22 -0400 Received: from [192.168.1.2] ([77.182.113.36]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MHp8z-1doKjg16Sr-003dnA; Wed, 30 Aug 2017 09:20:13 +0200 Subject: [PATCH 2/6] [media] cx24116: Return directly after a failed kmalloc() in cx24116_writeregN() 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: Date: Wed, 30 Aug 2017 09:20:12 +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:rn3LU52Dl3D8edGEwr5gpkefmFejoN+s/aCIqM4DqvhNJy8UKjC LTQMLsNsisGdLmuajCzgdo/EnPzaIlluCK1Tzktg2Nn9pIa7K3ALGr8W9JXIghTZ6SOEpz0 ZRGbDlrwCrQyRrnZvOrNkLcO3nrrjD50qAOmQVB6hNtp+lnEW7AgqyXcyKLRvE4dUfz3lQM SGnIbGRaxISJ6TzjMa10g== X-UI-Out-Filterresults: notjunk:1; V01:K0:NzA3raq3Tew=:kmPZ0N+pQdyypgi8Qfwop0 uG/KwSDm/SyaHJG2AaQ2euGDbOR9mlLKow5gnDr8FVgQ3L2Tp1h1kJv9L48v00nWPpSIhgiF3 VfsbMV2RBs0UKfWtxi+zP7q/arKkhD9cD/mzYRSplhpGMgvCWMh1bd7YiZPMS2n+t9fXKtMj5 1ZNBJTxnCV9daOwYA98LsxD8K1B+nU/4mSUJGWt9KxPzvK4WejHr4K0O1hpndjcl0ydiz1dlD OPOC5WKU+IfzLQPhP5sdmb0sQyea6Rt8vkGpK6ilrQM8u8SqOdK1NFHKKT87QIbMcI8NciNZ1 mRmI5wJEVckDjV8SNKHE1B8HDS0aeFjdRj5yrKY+qqL6JfFOqv3yDwqd8qp4LoEEBdMZ6tT91 P7XerL5CRjF3GVfuw2mWOUE9J1EU8kkNBlbTCyi4/BjGt8dKO2OL7mNeKNY532wtMqZSUvaIy wAtz+3elg18TMetMv5pdU0+fKofymc89haLQjF2aVnjO8crkK9aztXkmPsVdr8uSlpFeaywO3 NWhdEmStDIzAbOjP5Br5tN9J/5jZ+HoOYxF724rD1jIHf4DSPg5PwnbwGEnuwXlo3ssmjDCvF sW7hhutJv6GDeaLTpSWdP/wuHUG/CaVPH/td3v3eNS3lL90ok56ltxSd23jM4Gm0WAXhpQuPl XFQkdq8Hcuq+DjED7cbRPijzyTFKtR8RXvrmUM/ZL5XhsViwUtuGJe/1t3C602vPOsLcFlNdy 91tU4VdJLvFpbGBeHouBlY00iTcPmBs0E+NctgF4wnnQuBZIZbqWU5TGgYceQWbZzR3Yc7Ue7 gLs7FnwX+GilpdGz40XL5T0VvWdOB/KVsNHioGEsSIgjt/poI4= 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 07:55:49 +0200 * Return directly after a call of the function "kmalloc" failed at the beginning. * Delete the jump target "error" which became unnecessary with this refactoring. Signed-off-by: Markus Elfring --- drivers/media/dvb-frontends/cx24116.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/media/dvb-frontends/cx24116.c b/drivers/media/dvb-frontends/cx24116.c index 96af4ffba0f9..69c156443b50 100644 --- a/drivers/media/dvb-frontends/cx24116.c +++ b/drivers/media/dvb-frontends/cx24116.c @@ -226,10 +226,8 @@ static int cx24116_writeregN(struct cx24116_state *state, int reg, u8 *buf; buf = kmalloc(len + 1, GFP_KERNEL); - if (buf == NULL) { - ret = -ENOMEM; - goto error; - } + if (!buf) + return -ENOMEM; *(buf) = reg; memcpy(buf + 1, data, len); @@ -250,7 +248,6 @@ static int cx24116_writeregN(struct cx24116_state *state, int reg, ret = -EREMOTEIO; } -error: kfree(buf); return ret;