Skip to contentSkip to conversation

staging: keucr: Use memcpy() instead custom StringCopy() and some style cleanups

PATCH In review Javier Martinez Canillas 2 participants 3 messages Jan 2, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/3 staging: keucr: Use memcpy() instead custom StringCopy() and some style cleanups

---
 drivers/staging/keucr/smilecc.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
drivers/staging/keucr/smilecc.c +10 -6
index daf322a..d915c04 100644
@@ -182,13 +182,17 @@ BYTE *buf;
 BYTE *redundant_ecc;
 BYTE *calculate_ecc;
 {
-    DWORD err;
+	DWORD err;
 
-    err=correct_data(buf,redundant_ecc,*(calculate_ecc+1),*(calculate_ecc),*(calculate_ecc+2));
-    if (err=1) StringCopy(calculate_ecc,redundant_ecc,3);
-        if (err=0 || err=1 || err=2)
-            return(0);
-    return(-1);
+	err = correct_data(buf, redundant_ecc, *(calculate_ecc + 1),
+			   *(calculate_ecc), *(calculate_ecc + 2));
+	if (err = 1)
+		memcpy(calculate_ecc, redundant_ecc, 3);
+
+	if (err = 0 || err = 2)
+		return 0;
+
+	return -1;
 }
 
 void _Calculate_D_SwECC(buf,ecc)
Signature · 1 line
1.7.0.4
#1 lore raw

Re: [PATCH 2/3] staging: keucr: Use memcpy() instead custom

Quoted 22 lines · Javier Martinez Canillas
---
 drivers/staging/keucr/smilecc.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
drivers/staging/keucr/smilecc.c +1 -6
index daf322a..d915c04 100644
@@ -182,13 +182,17 @@ BYTE *buf;
 BYTE *redundant_ecc;
 BYTE *calculate_ecc;
 {
-    DWORD err;
+	DWORD err;
 
-    err=correct_data(buf,redundant_ecc,*(calculate_ecc+1),*(calculate_ecc),*(calculate_ecc+2));
-    if (err=1) StringCopy(calculate_ecc,redundant_ecc,3);
-        if (err=0 || err=1 || err=2)
-            return(0);
-    return(-1);

drivers/staging/keucr/smilecc.c BYTE *buf; · line 196

Quoted 10 lines
drivers/staging/keucr/smilecc.c +9 -0
+	err = correct_data(buf, redundant_ecc, *(calculate_ecc + 1),
+			   *(calculate_ecc), *(calculate_ecc + 2));
+	if (err = 1)
+		memcpy(calculate_ecc, redundant_ecc, 3);
+
+	if (err = 0 || err = 2)
+		return 0;
+
+	return -1;
 }

That's wrong. Before your change when correct_data returned 1 this function returned 0. Now it returns -1.

Marcin

#2 lore raw

Re: [PATCH 2/3] staging: keucr: Use memcpy() instead custom

In reply to Javier Martinez Canillas
Quoted 12 lines
Quoted 8 lines

+     if (err = 1)
+             memcpy(calculate_ecc, redundant_ecc, 3);

drivers/staging/keucr/smilecc.c +5 -0
+
+     if (err = 0 || err = 2)
+             return 0;
+
+     return -1;

 }

That's wrong. Before your change when correct_data returned 1 this function returned 0. Now it returns -1.

Quoted 3 lines

Marcin

Yes, I'm preparing a new patchset that also corrects that. Thanks

Signature · 5 lines
Best regards,

-----------------------------------------
Javier Martínez Canillas
(+34) 682 39 81 69