Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1260219ybl; Fri, 23 Aug 2019 16:24:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXQwNQ73FIIWLxb5OkxUPLRtxupsGkOdtUYwpDiXoagNBNF3/9ZKoqiSUx4wjXlzYBJxKT X-Received: by 2002:a17:902:e613:: with SMTP id cm19mr6999838plb.299.1566602662589; Fri, 23 Aug 2019 16:24:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566602662; cv=none; d=google.com; s=arc-20160816; b=JhL3EHpckrbc6y1hG6gdDgG1Hy5Xyq9F8X/upqXilKOHdrFCF1M31YLKdlZhBFTPdN jlvYz0bVJesj49s1BDbp+S0ifpgfcmbjZiHba780//l3Ap5U6I4mzM2OvoTIr0Hk5C2Z Eg5MKHhn+fZW00i/8X+1lR8oCNp0VxBDYWUjFX2VcvBJoJJnkANR+kaiKmTYKkZ6F3z4 7x9ujIB9qPnFMMBFqMfXhIbRZPsSdqaF9jjyIZJSUGhQJfY6Q2rbbjsZlGzmDbDC6xtc KNWSGtHbR1MIddFhYYw6Re5G+WglsF+9UPtCzK1gJfiI2E1IsTSq0fDeezolaVuzCqGc 4REA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:cc :autocrypt:openpgp:subject:from:to:dkim-signature; bh=JIaJBJSt57bLN53RjfaVGcxJg/Sa/VdDKwwW/EoeS5E=; b=TNX72vsISvgIy2Kj5wwPjW5vgaY9P4w1G0eGoPg+ld9zUylMVqzJYUb6LyoF/HjdjM WY5ZhLdhlMkvfQvjq+ggv7um5SCNduoMjbPMsFqwkMPIBn2cmP3Ljph8oz8YymMbu4QC zN1+jKqtgeaCJC4enKxT1X4SaINSh9Pkj2vlALPYuJAIOpn52qcIbGcmXb3v62xFpPow WEhSnFqmG1K5CgacIfz18XN+S861yRuegpPO7ZgGVseczlE6ykzFr7aFZMZJGC55zU5i lwkOt3oEny5u6S39k0/IwSxYsIUJmcH8qOU/qIkGfbxanY/eNBrfJv2/TnqNuGgtWGLL XhkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@web.de header.s=dbaedf251592 header.b=p20LNyLL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i4si3015789pgj.558.2019.08.23.16.24.07; Fri, 23 Aug 2019 16:24:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@web.de header.s=dbaedf251592 header.b=p20LNyLL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405533AbfHWNab (ORCPT + 99 others); Fri, 23 Aug 2019 09:30:31 -0400 Received: from mout.web.de ([212.227.15.3]:35907 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732014AbfHWNab (ORCPT ); Fri, 23 Aug 2019 09:30:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1566567020; bh=ALaFDHqwPH8Mt5DeXm4ojQGnigcAUy04TdDkzLYiDJE=; h=X-UI-Sender-Class:To:From:Subject:Cc:Date; b=p20LNyLL6Qtqx0hWLKG8oCnJbWfar2TVu/r30Jdqu2hnFXbqm8K3u3CRNjmL31pjz 0Eouugubdhibh/NZvK21hUStvYzqxJarQMb45GVEXqmt4s4rqnfeB8+mMRk1EzkY+t Cog62BaIHpZJueR59UxhAd4phKjo2umlsMg7vgwo= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from [192.168.1.2] ([93.133.157.93]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M6ml2-1iD4MS0yzU-00wZ94; Fri, 23 Aug 2019 15:30:20 +0200 To: devel@driverdev.osuosl.org, Forest Bond , Greg Kroah-Hartman , Quentin Deslandes From: Markus Elfring Subject: [PATCH] staging: vt6656: Use common error handling code in vnt_alloc_bufs() Openpgp: preference=signencrypt Autocrypt: addr=Markus.Elfring@web.de; prefer-encrypt=mutual; keydata= mQINBFg2+xABEADBJW2hoUoFXVFWTeKbqqif8VjszdMkriilx90WB5c0ddWQX14h6w5bT/A8 +v43YoGpDNyhgA0w9CEhuwfZrE91GocMtjLO67TAc2i2nxMc/FJRDI0OemO4VJ9RwID6ltwt mpVJgXGKkNJ1ey+QOXouzlErVvE2fRh+KXXN1Q7fSmTJlAW9XJYHS3BDHb0uRpymRSX3O+E2 lA87C7R8qAigPDZi6Z7UmwIA83ZMKXQ5stA0lhPyYgQcM7fh7V4ZYhnR0I5/qkUoxKpqaYLp YHBczVP+Zx/zHOM0KQphOMbU7X3c1pmMruoe6ti9uZzqZSLsF+NKXFEPBS665tQr66HJvZvY GMDlntZFAZ6xQvCC1r3MGoxEC1tuEa24vPCC9RZ9wk2sY5Csbva0WwYv3WKRZZBv8eIhGMxs rcpeGShRFyZ/0BYO53wZAPV1pEhGLLxd8eLN/nEWjJE0ejakPC1H/mt5F+yQBJAzz9JzbToU 5jKLu0SugNI18MspJut8AiA1M44CIWrNHXvWsQ+nnBKHDHHYZu7MoXlOmB32ndsfPthR3GSv jN7YD4Ad724H8fhRijmC1+RpuSce7w2JLj5cYj4MlccmNb8YUxsE8brY2WkXQYS8Ivse39MX BE66MQN0r5DQ6oqgoJ4gHIVBUv/ZwgcmUNS5gQkNCFA0dWXznQARAQABtCZNYXJrdXMgRWxm cmluZyA8TWFya3VzLkVsZnJpbmd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WzHpWaHmSuU3JSAMB/N+yQjIad2ztTckZY pwT6oxng29LzZspTYUEzMz3wK2jQHw+U66qBFk8whA7B2uAU1QdGyPgahLYSOa4XAEGb6wbI FEE= Cc: LKML , kernel-janitors@vger.kernel.org Message-ID: <91e8a9b7-e79d-dafc-10b8-dd79eb59eff9@web.de> Date: Fri, 23 Aug 2019 15:30:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:4Q1UCrgqX3Wfn+IdiS0GOWjaZjKOAmQDNl55ErMjtkYBuB9Jc4c FOfOVb2sBF+wwE/Cf5hBkyjHnBw9OZEkZywetS0GIvYXAMqCek4f/D/ujdGqdEmRoRSSDMS qa1ezt/cp93a5x/tyJx0PzZHCjYCQe5gwSnWJOKlDOhOm+Y9BuuRh69O6w7jolSBnK0njyV xHMIi3M8E3npW8+768NeA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:NMFuZg+YpOw=:Wy50rB9lL65hc2IhRNjZm6 z8Mz784OCczlaZuYnK3gm5yG3cSbqxLfvHAKa5g8K3hZHkFf4tQxqlSE9/8KWJjD7jo5odHLW VZvoERnpLIwaXFgJSqaoY18OY3lTaRqFxjJTFg43JtOLgZuPbYLJvFyF3fiyihgZHrFjHaZLS Ua8ocJ+QrqnprnJC+0Mf4dr2X5GsWogaGvO1nEUlBZA0/t8gPHlb6hBsnd1CPybzDzn9VrH4c FbdCHTzxuw0OyrYi1qj7+AldxiU6FCZVtBv4oSHSl59n2E5zMmcRKjaqOpsfPBHnLUQ1Vnmuf mT4zrqTim6CFP/l3f+i2/Yyihyd9I8IYEbS7Std3lGFzFGtIYwBzNSk7rAta4f3wmkno4dpU+ m5P5kQA2M/jXgBRp8zrTr3JI86Dki1+hlG+ux4Ph8PVMP7uoji0K8KIQjbjxGlUtHY0uYeFBC JpXnDDTtX3XwNhYH1QPW66hra3LPkaLL8G619UO9KQqXyOBnAC94kpDhurIxr7Iz+8aPmHQBe 93GveCdmGjfX3/QrlkcGIfV9VekCDyNrXe05ETeyF7XtnDLJXB874CLA/nXJ96yaW1x9bsiaP 0I13+kM0rgyy4HMgz5QAhrkgSrL/gmK28z5zpaLLxWwkaNnDA1QVxkldMNkxB8V9l23n3Y58f YzHIT0RIMRSNtrXfsrncY2A7oASn8j13OqhNs9zTDtevB9q6NRDn1vf8PqaVLsDZHLh7yrLv+ hdfakVfeeMRw/HZibHMrIXHq52iteH9YW00CjYXXvdLyX6pjoq1W3jdRIEVFB9P2CleGGGx9B kmVcBr4MmGxkMilgYz2v9ZtsFJ9fc/u1kAnOZOsT076bSfNW3GJltrCJvk9i0HUmEEF6kGGGx r7JbgNZt+rQPiKrArN/GoHnN3PM1MMDce0j1vnNC64uuYgPhi5Vd29I1DmAh/tdSpCRy1qWSc o0BYBc2rVLptogyZkJtCat5WSWE5GTWcRVE085O6HVTLvvGWV6e8y+gxnzH+pTUzvPY8LxLYb /+5rlHdIJm2ljlA45LaunR3cgsoO8AlZFej+RGCmNSGuxw0HAF9XCZkMH0/Fvobxy28KtCtEC 1+11y8bh5lxsx7VGIVztCgslaqqa4DDTDoO6GssARqnL7RjNr8fqDZjrfEDzaj7rHQ6x5jthn q/2/8Z4ISvNAknkt6zQMmPnnrJwRC4OoGvRdlS/jVDEhjoEA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Fri, 23 Aug 2019 15:15:41 +0200 Adjust jump targets so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring =2D-- drivers/staging/vt6656/main_usb.c | 46 +++++++++++++------------------ 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/ma= in_usb.c index 856ba97aec4f..d9f14da37bbc 100644 =2D-- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -443,10 +443,8 @@ static int vnt_alloc_bufs(struct vnt_private *priv) for (ii =3D 0; ii < priv->num_tx_context; ii++) { tx_context =3D kmalloc(sizeof(*tx_context), GFP_KERNEL); - if (!tx_context) { - ret =3D -ENOMEM; - goto free_tx; - } + if (!tx_context) + goto e_nomem_tx; priv->tx_context[ii] =3D tx_context; tx_context->priv =3D priv; @@ -454,20 +452,16 @@ static int vnt_alloc_bufs(struct vnt_private *priv) /* allocate URBs */ tx_context->urb =3D usb_alloc_urb(0, GFP_KERNEL); - if (!tx_context->urb) { - ret =3D -ENOMEM; - goto free_tx; - } + if (!tx_context->urb) + goto e_nomem_tx; tx_context->in_use =3D false; } for (ii =3D 0; ii < priv->num_rcb; ii++) { priv->rcb[ii] =3D kzalloc(sizeof(*priv->rcb[ii]), GFP_KERNEL); - if (!priv->rcb[ii]) { - ret =3D -ENOMEM; - goto free_rx_tx; - } + if (!priv->rcb[ii]) + goto e_nomem_rx; rcb =3D priv->rcb[ii]; @@ -475,16 +469,12 @@ static int vnt_alloc_bufs(struct vnt_private *priv) /* allocate URBs */ rcb->urb =3D usb_alloc_urb(0, GFP_KERNEL); - if (!rcb->urb) { - ret =3D -ENOMEM; - goto free_rx_tx; - } + if (!rcb->urb) + goto e_nomem_rx; rcb->skb =3D dev_alloc_skb(priv->rx_buf_sz); - if (!rcb->skb) { - ret =3D -ENOMEM; - goto free_rx_tx; - } + if (!rcb->skb) + goto e_nomem_rx; rcb->in_use =3D false; @@ -495,21 +485,23 @@ static int vnt_alloc_bufs(struct vnt_private *priv) } priv->interrupt_urb =3D usb_alloc_urb(0, GFP_KERNEL); - if (!priv->interrupt_urb) { - ret =3D -ENOMEM; - goto free_rx_tx; - } + if (!priv->interrupt_urb) + goto e_nomem_rx; priv->int_buf.data_buf =3D kmalloc(MAX_INTERRUPT_SIZE, GFP_KERNEL); - if (!priv->int_buf.data_buf) { - ret =3D -ENOMEM; + if (!priv->int_buf.data_buf) goto free_rx_tx_urb; - } return 0; +e_nomem_tx: + ret =3D -ENOMEM; + goto free_tx; + free_rx_tx_urb: usb_free_urb(priv->interrupt_urb); +e_nomem_rx: + ret =3D -ENOMEM; free_rx_tx: vnt_free_rx_bufs(priv); free_tx: =2D- 2.23.0