linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-media@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Mike Isely <isely@pobox.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 3/3] [media] pvrusb2-ioread: Delete unnecessary braces in six functions
Date: Wed, 20 Sep 2017 08:38:46 +0200	[thread overview]
Message-ID: <4d51ebb3-67bc-42c5-4be7-1379f2fb259b@users.sourceforge.net> (raw)
In-Reply-To: <c8117427-6d4d-0a1c-96c7-56e25d838b3e@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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,
-- 
2.14.1

      parent reply	other threads:[~2017-09-20  6:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20  6:33 [PATCH 0/3] [media] pvrusb2-ioread: Fine-tuning for eight function implementations SF Markus Elfring
2017-09-20  6:36 ` [PATCH 1/3] [media] pvrusb2-ioread: Use common error handling code in pvr2_ioread_get_buffer() SF Markus Elfring
2017-09-20  6:37 ` [PATCH 2/3] [media] pvrusb2-ioread: Delete an unnecessary check before kfree() in two functions SF Markus Elfring
2017-09-20  6:38 ` SF Markus Elfring [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4d51ebb3-67bc-42c5-4be7-1379f2fb259b@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=isely@pobox.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).