From patchwork Wed Sep 20 06:38:46 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: 9960941 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 F329A60234 for ; Wed, 20 Sep 2017 06:39:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6C8E28FAC for ; Wed, 20 Sep 2017 06:39:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBC5D28FC5; Wed, 20 Sep 2017 06:39:21 +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 901AA28FAC for ; Wed, 20 Sep 2017 06:39:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751663AbdITGiz (ORCPT ); Wed, 20 Sep 2017 02:38:55 -0400 Received: from mout.web.de ([212.227.15.4]:57012 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751551AbdITGix (ORCPT ); Wed, 20 Sep 2017 02:38:53 -0400 Received: from [192.168.1.2] ([77.181.108.184]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MWirL-1dsCJY13xj-00XpsR; Wed, 20 Sep 2017 08:38:47 +0200 Subject: [PATCH 3/3] [media] pvrusb2-ioread: Delete unnecessary braces in six functions From: SF Markus Elfring To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Mike Isely Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <4d51ebb3-67bc-42c5-4be7-1379f2fb259b@users.sourceforge.net> Date: Wed, 20 Sep 2017 08:38:46 +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:Ab5FfXok2qg24fe0pPc4HBL23x+WXLAPdTrew7iW/RhguHy6gQB VmfRfxab6XMZ5gqY4nIYQWvIW/bq55JofdLFoL5tmOXi2R7Q2Rwb2Vq4NkvD+9pVTkebZLH VDqyyIM1kgodQXg+8ARaa7yG8hNzJN29k+Mm8YxPouJA+3nu+oejkgGKRMUCTG32zQ9cQ8e J/u8q1IeWht88cjrxKwDw== X-UI-Out-Filterresults: notjunk:1; V01:K0:7W49OgEMuro=:SweWmUjn0Sg6B5auKAKvEx aGXwFwQMdrJoU09S2vl/ds5YZkKk9E1yb5Y5CW/iN7zPxr7HYXFJuESwvXUkJn4vX1g+SIoD8 tLr5Ag0tcolPG1sbQ3yO+dLftSEUaILSKZwcMxsJtvh4qDg8mnTZ4zWjwQlut7ELjR8RcplJn GpAkjWd/8RLpkndD/gUOIMf7tUuAg7aXGCVabuqhjJK8sEEbagqlFGzFj7xxa/VfvttZasHMv PfCpcCLPdvoOaBjjV/Xkk12Gz4bz7R1GcV1iwB+1pGrwyhQOn4W0X895CnMu5nAi62ctRTRq7 H7XuAetGClmFnSiyaQoDvmfE/frKShnWUHEJXpFrBKbQrc7TxXM1GHwOuIMM0abFocTTlcSbf lBxnK3FUd7avITIrd94Rjqfif3afMH6qLyiR2BgtoAU1IH625IQIElRNwEERQOsrfpVtrPe/j gXf8GK4c3NN9s2zpg0yTDxyu+lktyJqTuQxB1FLBG1T9xM+mYYSiRqsfJ6WAS2qZsBysPg5V4 MiDRe+ExQlqYxv61QrMNPnD5wGYOd7gNuLaRhqZfMUaKr4uZOPH+3W90x3Ec+Cy0Xe9inbXSU VgkuktmQ9Uw8e1uUhm8atnuyaETBmUfYKUGgoAWT0mJqkY92nJigiNLZ2thXPvUoGRWpYssHz 3f8yTN7xBIs6TYqtKmN9hjwsBul/yPJe2iVyPHBYMxARV0D4g2OIZEz/ouHZvq0VXeDUJfDar r88wQStLn6NHn4LfNYuXp1x+MqrGZHnBdU+c7cfV++Kva4v3XncAXl6q26X3Yhlr1r+IupRaQ yaHdu+wfx6jFeDq2GZSmlibAEuNExMqww+rRsLU0GTOF9mWt9s= 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, 20 Sep 2017 08:15:51 +0200 Do not use curly brackets at some source code places where a single statement should be sufficient. Signed-off-by: Markus Elfring --- drivers/media/usb/pvrusb2/pvrusb2-ioread.c | 38 ++++++++++++------------------ 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-ioread.c b/drivers/media/usb/pvrusb2/pvrusb2-ioread.c index 4349f9b5f838..9a0eb2875c9a 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-ioread.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-ioread.c @@ -120,9 +120,8 @@ void pvr2_ioread_set_sync_key(struct pvr2_ioread *cp, cp->sync_key_len = 0; if (sync_key_len) { cp->sync_key_ptr = kmalloc(sync_key_len,GFP_KERNEL); - if (cp->sync_key_ptr) { + if (cp->sync_key_ptr) cp->sync_key_len = sync_key_len; - } } } if (!cp->sync_key_len) return; @@ -203,9 +202,9 @@ int pvr2_ioread_setup(struct pvr2_ioread *cp,struct pvr2_stream *sp) cp); pvr2_ioread_stop(cp); pvr2_stream_kill(cp->stream); - if (pvr2_stream_get_buffer_count(cp->stream)) { + if (pvr2_stream_get_buffer_count(cp->stream)) pvr2_stream_set_buffer_count(cp->stream,0); - } + cp->stream = NULL; } if (sp) { @@ -238,13 +237,10 @@ int pvr2_ioread_set_enabled(struct pvr2_ioread *cp,int fl) if ((!fl) == (!(cp->enabled))) return ret; mutex_lock(&cp->mutex); - do { - if (fl) { - ret = pvr2_ioread_start(cp); - } else { - pvr2_ioread_stop(cp); - } - } while (0); + if (fl) + ret = pvr2_ioread_start(cp); + else + pvr2_ioread_stop(cp); mutex_unlock(&cp->mutex); return ret; } @@ -318,13 +314,12 @@ static void pvr2_ioread_filter(struct pvr2_ioread *cp) for (idx = cp->c_data_offs; idx < cp->c_data_len; idx++) { if (cp->sync_buf_offs >= cp->sync_key_len) break; if (cp->c_data_ptr[idx] == - cp->sync_key_ptr[cp->sync_buf_offs]) { + cp->sync_key_ptr[cp->sync_buf_offs]) // Found the next key byte (cp->sync_buf_offs)++; - } else { + else // Whoops, mismatched. Start key over... cp->sync_buf_offs = 0; - } } // Consume what we've walked through @@ -360,10 +355,10 @@ static void pvr2_ioread_filter(struct pvr2_ioread *cp) int pvr2_ioread_avail(struct pvr2_ioread *cp) { int ret; - if (!(cp->enabled)) { + + if (!cp->enabled) // Stream is not enabled; so this is an I/O error return -EIO; - } if (cp->sync_state == 1) { pvr2_ioread_filter(cp); @@ -372,15 +367,13 @@ int pvr2_ioread_avail(struct pvr2_ioread *cp) ret = 0; if (cp->stream_running) { - if (!pvr2_stream_get_ready_count(cp->stream)) { + if (!pvr2_stream_get_ready_count(cp->stream)) // No data available at all right now. ret = -EAGAIN; - } } else { - if (pvr2_stream_get_ready_count(cp->stream) < BUFFER_COUNT/2) { + if (pvr2_stream_get_ready_count(cp->stream) < BUFFER_COUNT / 2) // Haven't buffered up enough yet; try again later ret = -EAGAIN; - } } if ((!(cp->spigot_open)) != (!(ret == 0))) { @@ -476,14 +469,13 @@ cp); mutex_unlock(&cp->mutex); if (!ret) { - if (copied_cnt) { + if (copied_cnt) // If anything was copied, return that count ret = copied_cnt; - } else { + else // Nothing copied; suggest to caller that another // attempt should be tried again later ret = -EAGAIN; - } } pvr2_trace(PVR2_TRACE_DATA_FLOW,