From patchwork Fri Jan 13 17:28:17 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: 9516097 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 E68046077E for ; Fri, 13 Jan 2017 17:28:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D573B28763 for ; Fri, 13 Jan 2017 17:28:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA7AB28766; Fri, 13 Jan 2017 17:28:40 +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=ham 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 8413728763 for ; Fri, 13 Jan 2017 17:28:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751243AbdAMR21 (ORCPT ); Fri, 13 Jan 2017 12:28:27 -0500 Received: from mout.web.de ([217.72.192.78]:49748 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750975AbdAMR2Z (ORCPT ); Fri, 13 Jan 2017 12:28:25 -0500 Received: from [192.168.1.2] ([78.49.203.248]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0M1G68-1chgh03D6u-00tFb2; Fri, 13 Jan 2017 18:28:18 +0100 Subject: [PATCH 17/17] spi/topcliff-pch: One check less in pch_spi_set_tx() To: linux-spi@vger.kernel.org, Mark Brown References: <1413e173-dbac-7a6e-09cb-2287300a335e@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: Date: Fri, 13 Jan 2017 18:28:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <1413e173-dbac-7a6e-09cb-2287300a335e@users.sourceforge.net> X-Provags-ID: V03:K0:no6RQrqIDF9iLgPPt+Xou9plqZC9AbhvhRcb+mGF6WiTJhGJ/gg /ykz9pHzoPnMhRaPmlzBQH/oEO/KJK10+7f+osW21zYXmfy9cxf69udhLjr629IL9ZFnXyQ b6hyc7cUl2wgKLeixdg9MIK1sopbZX3PQeaPkj7gKikriPZ1Jsu7vzJJHDAH0CrfdxgTAPx V5F1DMJmSZ08NbxzXzaVg== X-UI-Out-Filterresults: notjunk:1; V01:K0:L7xr/kTYEL4=:z+Fb/vkI7sZvkC0QVSU6Cl 7JtK/asCjgVkDGhJXggxOwPO1KpOfjw5XitZ5rCQDwkgfgNzcy/J60s8q+59a4Pj0ahNtWNn2 S8uRDZr2tbyOXhIpdS5bnzRbN77H7tGkKEJjuIUHjLv6+ncMGXXUBkgr3uw+gysnuDGS6FGEA OKhup2C17N8/TuCNsf+ZTtOu5aXYZW3Cq0bSHVeiT1Vqi/14f/1few0woLK4V4PM5byrwQ8zO DYaEZ5C1Ln7laZLsyHwjnTI6qjVME2XTTNstqkeuz8vtRSOShShLlucLFfjhhW5ekFKCSOQh2 XeA835x3oJDluPs0A1vcij6UGk6R+f6Zu49bubWvjPZaVKqlNGu6UvXxDOF5KrAHXVt/RXnkp IVocT1XNdc4m5nX7DhSNhwMsb/IT5cys20vWYz13rhEOm9DRCA9JFAb2hC5MA8ZRshd/KRRTt T92wR2xY/O1UAkwytdWPpPYdTKzkfoId6iHZxdllZnk364ZDnOG/VlmK3KSoK8KxfD/MxXkMT gnKhT8FkDOsmLe/BBf1t+xENhcGMxWVL9b7jb2DSIA2y8hHRJMTik+JCAtOoIh1Vrf9ElRxTt dDmsY6DXXvyYd9NIk9iUYtOuPl4/LNFssz++xroq3eLQ6ryX2DT/MotM4qktZ3beO45rFGM91 064za55UxJcXVey6Lo0bh+0reeTswr287sMCk3XTFE3w0ggFJoe1NU18OGYl9bujFLjSqxu6f ElSpuIn84JRfzrTpDH1nqzU+PmEmftxXVEKC6VKod9J/ae5pPvtr0Iu3PZyBYZk9shhS4nnRj fq9rSUA Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Fri, 13 Jan 2017 17:30:46 +0100 Delete a duplicate check after a bit of exception handling was moved into a previous if branch of this function. Signed-off-by: Markus Elfring --- drivers/spi/spi-topcliff-pch.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c index 97fd1ea9826b..33043a830032 100644 --- a/drivers/spi/spi-topcliff-pch.c +++ b/drivers/spi/spi-topcliff-pch.c @@ -584,22 +584,25 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw) data->pkt_tx_buff = kzalloc(size, GFP_KERNEL); if (data->pkt_tx_buff) { data->pkt_rx_buff = kzalloc(size, GFP_KERNEL); - if (!data->pkt_rx_buff) + if (!data->pkt_rx_buff) { kfree(data->pkt_tx_buff); - } - if (!data->pkt_rx_buff) { - /* flush queue and set status of all transfers to -ENOMEM */ - list_for_each_entry_safe(pmsg, tmp, data->queue.next, queue) { - pmsg->status = -ENOMEM; + /* + * Flush queue and set status of all transfers + * to -ENOMEM. + */ + list_for_each_entry_safe(pmsg, tmp, data->queue.next, + queue) { + pmsg->status = -ENOMEM; - if (pmsg->complete) - pmsg->complete(pmsg->context); + if (pmsg->complete) + pmsg->complete(pmsg->context); - /* delete from queue */ - list_del_init(&pmsg->queue); + /* delete from queue */ + list_del_init(&pmsg->queue); + } + return; } - return; } /* copy Tx Data */