From patchwork Fri Jan 1 21:33:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 7940061 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6F1389F38D for ; Fri, 1 Jan 2016 21:35:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8BDFE204EB for ; Fri, 1 Jan 2016 21:35:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B74C3204E7 for ; Fri, 1 Jan 2016 21:35:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752432AbcAAVeY (ORCPT ); Fri, 1 Jan 2016 16:34:24 -0500 Received: from mout.web.de ([212.227.17.11]:50781 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752292AbcAAVeW (ORCPT ); Fri, 1 Jan 2016 16:34:22 -0500 Received: from [192.168.1.2] ([77.182.63.9]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0LqUbl-1ZkRL50kaX-00e4RW; Fri, 01 Jan 2016 22:33:42 +0100 Subject: [PATCH] net-libertas: Better exception handling in if_spi_host_to_card_worker() References: <566ABCD9.1060404@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall To: libertas-dev@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Kalle Valo From: SF Markus Elfring Message-ID: <5686F0B2.5000000@users.sourceforge.net> Date: Fri, 1 Jan 2016 22:33:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <566ABCD9.1060404@users.sourceforge.net> X-Provags-ID: V03:K0:Ht1GkBJlsU3xy/UTlT+4rznXHE1iZ7qsC3CGTGw1wOSCAManE7h 4PZjEtOxi1987j1IfgQrCtLK6OgWab9jzcLjYQdHoZaaMkZ6Dekb2RC6Nc8GjtDg7P3ZdgG z7EY0xwmLpSRiH4eyo+63i8VM7JaPFD7swfFJeiUvExBxOkE76BidD7qB+sLIR2C90pB5KC YJqQSK30N7Z6sRJcE4zdQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:u656gz2d4Pg=:uiw3yNnmqQYY3DNqhTd79Q CvkxA3ehnlMvIVgm4jqt4v2rvsvWqmcZ7jcAt3CgMCxAzwGgt7K3Oc+rSUygfMLEN1mqqZP9k HNyjoLDd5QVMz8pIJmLRQ2pWAgs1EgNph/J8N+58kYH4QmQiXoDIu9i0apCxtvb/Mu6f0L3uR lnExm9eGt5v0x/NuUgY3bI1kwNg5iaUFBncnVu1LdjFSkscPfieLokvvfXZqnNbsDQPOJNcVJ 0pU5iorj1rKx/S9vcpw4p/9jVzgHLlxqDAVTczA+PQwkWDASZOeWZUrgb0kanJi6Q4oCP5uYo h+F6s40DeprZvv9ruwXK+oX11pSD3w+KuthTBbuD+8X3xU/mfkevqJxCXwAlLGzxamsl++4aJ 6oLuzbn9rWcZRlsGVK4EWFrzpQ0GqBkbQEmiIErO9oX3ToPXSgfqX5M3ygKu7eu+KinJcy5E7 bU8x6AdLMxAEicgXBf+dBlg4DHAjUT7xb8wrHpjD/pToe8g8XVJak0Ygo1cpCCY48YVQDYSeT gWtcfTCv+j7e0OINruiJztNEoKQ23hTHjaIOx19VMdw8xWnwVSvCdGZiGrfvx46O5e5uxwLt7 gc0WbzusKy6MGH0WVfEPsNkvEpawclHN4m4u6izK31hXH56kYRp7LBkXB77eaHgXFwPFvdl0L ews1Rimdm1nqNTexFZh88r93HDKLMgE23TpvAcjeH39Ru8HadsXkbLWcVU6+Ij2QN2MO4FNrL fM8onIttM1KZSLmP97fBYvdk2KmI2IqvwNvNP/yOIwdSNer1GSHHbutjGdSqLZXDQaE9Ilyj3 G3u+YHp Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Fri, 1 Jan 2016 22:27:20 +0100 This issue was detected by using the Coccinelle software. Move the jump label directly before the desired log statement so that the variable "err" will not be checked once more after it was determined that a function call failed. Use the identifier "report_failure" instead of the label "err". Signed-off-by: Markus Elfring --- drivers/net/wireless/marvell/libertas/if_spi.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/marvell/libertas/if_spi.c b/drivers/net/wireless/marvell/libertas/if_spi.c index 82c0796..c9ae27e 100644 --- a/drivers/net/wireless/marvell/libertas/if_spi.c +++ b/drivers/net/wireless/marvell/libertas/if_spi.c @@ -880,18 +880,18 @@ static void if_spi_host_to_card_worker(struct work_struct *work) &hiStatus); if (err) { netdev_err(priv->dev, "I/O error\n"); - goto err; + goto report_failure; } if (hiStatus & IF_SPI_HIST_CMD_UPLOAD_RDY) { err = if_spi_c2h_cmd(card); if (err) - goto err; + goto report_failure; } if (hiStatus & IF_SPI_HIST_RX_UPLOAD_RDY) { err = if_spi_c2h_data(card); if (err) - goto err; + goto report_failure; } /* @@ -940,9 +940,10 @@ static void if_spi_host_to_card_worker(struct work_struct *work) if (hiStatus & IF_SPI_HIST_CARD_EVENT) if_spi_e2h(card); -err: - if (err) + if (err) { +report_failure: netdev_err(priv->dev, "%s: got error %d\n", __func__, err); + } lbs_deb_leave(LBS_DEB_SPI); }