Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1500431 > unrolled thread

[PATCH 02/18] [media] RedRat3: Move two assignments in redrat3_transmit_ir()

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2016-10-13 18:30 +0200
Last post2016-10-14 14:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 02/18] [media] RedRat3: Move two assignments in  redrat3_transmit_ir() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-13 18:30 +0200
    Re: [PATCH 02/18] [media] RedRat3: Move two assignments in  redrat3_transmit_ir() Dan Carpenter <dan.carpenter@oracle.com> - 2016-10-14 10:20 +0200
      Re: [media] RedRat3: Move two assignments in redrat3_transmit_ir()? SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-14 14:10 +0200

#1500431 — [PATCH 02/18] [media] RedRat3: Move two assignments in redrat3_transmit_ir()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-13 18:30 +0200
Subject[PATCH 02/18] [media] RedRat3: Move two assignments in redrat3_transmit_ir()
Message-ID<srR3j-5Qh-41@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Oct 2016 10:25:57 +0200

Move the assignment for the data structure member "transmitting"
and the local variable "curlencheck" behind the source code
for memory allocations by this function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/rc/redrat3.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
index d89958b..f5a6850 100644
--- a/drivers/media/rc/redrat3.c
+++ b/drivers/media/rc/redrat3.c
@@ -727,7 +727,7 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf,
 	int ret, ret_len;
 	int lencheck, cur_sample_len, pipe;
 	int *sample_lens = NULL;
-	u8 curlencheck = 0;
+	u8 curlencheck;
 	unsigned i, sendbuf_len;
 
 	if (rr3->transmitting) {
@@ -738,9 +738,6 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf,
 	if (count > RR3_MAX_SIG_SIZE - RR3_TX_TRAILER_LEN)
 		return -EINVAL;
 
-	/* rr3 will disable rc detector on transmit */
-	rr3->transmitting = true;
-
 	sample_lens = kcalloc(RR3_DRIVER_MAXLENS,
 			      sizeof(*sample_lens),
 			      GFP_KERNEL);
@@ -755,6 +752,9 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf,
 		goto out;
 	}
 
+	/* rr3 will disable rc detector on transmit */
+	rr3->transmitting = true;
+	curlencheck = 0;
 	for (i = 0; i < count; i++) {
 		cur_sample_len = redrat3_us_to_len(txbuf[i]);
 		if (cur_sample_len > 0xffff) {
-- 
2.10.1

[toc] | [next] | [standalone]


#1500741

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-10-14 10:20 +0200
Message-ID<ss5SG-7dR-15@gated-at.bofh.it>
In reply to#1500431
I have asked you about six or seven times to only send bug fixes and
stop sending clean up patches.  You have refused.  But now I'm asking
you to stop randomly doing things without at least thinking about it for
a bit.

The original code was correct.

regards,
dan carpenter

[toc] | [prev] | [next] | [standalone]


#1500874 — Re: [media] RedRat3: Move two assignments in redrat3_transmit_ir()?

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-10-14 14:10 +0200
SubjectRe: [media] RedRat3: Move two assignments in redrat3_transmit_ir()?
Message-ID<ss9tf-15v-7@gated-at.bofh.it>
In reply to#1500741
> The original code was correct.

Your view can be appropriate for this function implementation to some degree.

I got the impression that it contains the specification of assignments
which will happen a bit too early here.
Is this a weakness for which software developers can care about?

Regards,
Markus

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web