From patchwork Sun Oct 29 20:16:02 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: 10031655 X-Patchwork-Delegate: kvalo@adurom.com 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 260FB600C5 for ; Sun, 29 Oct 2017 20:16:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19B1928759 for ; Sun, 29 Oct 2017 20:16:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E1AB2875B; Sun, 29 Oct 2017 20:16:33 +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 AFE2428759 for ; Sun, 29 Oct 2017 20:16:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751930AbdJ2UQS (ORCPT ); Sun, 29 Oct 2017 16:16:18 -0400 Received: from mout.web.de ([212.227.15.14]:55693 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751315AbdJ2UQQ (ORCPT ); Sun, 29 Oct 2017 16:16:16 -0400 Received: from [192.168.1.2] ([78.49.32.239]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M9MDO-1e0cXq0URi-00CgbB; Sun, 29 Oct 2017 21:16:04 +0100 Subject: [PATCH 5/5] wlcore: Use common error handling code in wl1271_op_suspend() From: SF Markus Elfring To: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Arend Van Spriel , Eyal Reizer , Iain Hunter , James Minor , Johannes Berg , Kalle Valo , Maxim Altshul , Pieter-Paul Giesberts Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <5c4844e8-b519-888d-c772-4f925a4f2a66@users.sourceforge.net> Date: Sun, 29 Oct 2017 21:16:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:OHQMAFhQo9JhtsjhW4jDal1k9QZwM7vpurWnE6uUrpbYgQMW1ep ITWJb1XU9Gd6em61RfB72//n88n8sho4XHo4J8YYieRwrH1QrccFrmGGnfDdHtvlZdXW+SF /hZHviGV+XPO2FXWvQjDbb0L6ZTFeWxy5PrydOZZz9RFamTtPghqJM+t+6AirWr084hqzdk 6NZaBfIql/S+nJOzRmV0g== X-UI-Out-Filterresults: notjunk:1; V01:K0:jNEhR4vKpA4=:otmfD6uphn4Hzrerd3NiEP nXtm74jcdp+iyV/Wy3R5lKd56ZZ8wdoHgTlnk0bqDUXFwUHvkeW8/JYFaNWV52AY1rAkmUM6M WrEazqyqk8AlsN4an0K7gCXekq//FBDwI4LcYXxp+0SqNDT7d95JVe8o7Kte6MrskqGvorB52 v1KTyLT5iR95e40Y2rmr/Ml7ATZ1XyXLjD/KaH5svTgVzuUx7ic5f3rESi3RD1xbaxHGvCXh5 9hVnvrrXdHkoyeZhBZH6lzEBxsdSF9sITz+PDoizu6jVDA7S4XvHR8S1s2YGpckdoNUWi5pyv V5gcltiEOwPMgUSixWUYWiJ5a+6Eg6ST9h/VsS1HNs7C6HvaDRe8HwcrQhHySVtXaVFIgbbMb WYmD5HLnQKwffQCoKjnhx69gPvuZRX7EH3XA3NNqe8Sn8FwNP7iqtdTSyLijUwysdaFkFRb5+ p5AhUTacKNmzBdk9h+XP6tVZsFrb9gB23PVdpdfvBW9xNY3IEi2Y6OlfvCn0dE869+yDpEuU9 lNXUH1INdd2J/GM1JO4cpdSPYvVsxMio+RLHFZj/wu4hCDDhk3Ouy3e8djOeN5SgVo0cIcx6a BzZq16WFnnmGxHa4xTTI4K//6Wr3Jz1pFFcYtWI/JMnkMx9jGIr/ypUcVFKEgy1TXFNCGKpei CEEwSVT4b84PmKA8GQHVYTqwPC99nWJdjl7tRCJm633MQLRw8aXFaLeTlBqzYeLeOJgeRhEPN fy10xQxyrIN3hfPeEQMaNvJT6DzTqw/qLGpnTdqNQu+7ssFEH4s3saUAKo6I2enZMZMPgYus2 lIN8AoDJRjErYkWl5kspWcsWVlov2uXWU37KYzTr2wZsV43TEA= Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 29 Oct 2017 20:36:39 +0100 Add a jump target so that a specific error message is stored only once at the end of this function implementation. Replace two calls of the macro "wl1271_warning" by goto statements. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/net/wireless/ti/wlcore/main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 12a9d6509382..a110f61110d5 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -1732,8 +1732,7 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw, ret = wl1271_configure_suspend(wl, wlvif, wow); if (ret < 0) { mutex_unlock(&wl->mutex); - wl1271_warning("couldn't prepare device to suspend"); - return ret; + goto report_preparation_failure; } } @@ -1752,10 +1751,8 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw, wl1271_ps_elp_sleep(wl); mutex_unlock(&wl->mutex); - if (ret < 0) { - wl1271_warning("couldn't prepare device to suspend"); - return ret; - } + if (ret < 0) + goto report_preparation_failure; /* flush any remaining work */ wl1271_debug(DEBUG_MAC80211, "flushing remaining works"); @@ -1783,6 +1780,10 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw, cancel_delayed_work(&wl->tx_watchdog_work); return 0; + +report_preparation_failure: + wl1271_warning("couldn't prepare device to suspend"); + return ret; } static int wl1271_op_resume(struct ieee80211_hw *hw)