aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/ide-iops.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 8cfa6125c7a4..004803030f64 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -423,14 +423,16 @@ void ide_fix_driveid(u16 *id)
423 423
424void ide_fixstring (u8 *s, const int bytecount, const int byteswap) 424void ide_fixstring (u8 *s, const int bytecount, const int byteswap)
425{ 425{
426 u8 *p = s, *end = &s[bytecount & ~1]; /* bytecount must be even */ 426 u8 *p, *end = &s[bytecount & ~1]; /* bytecount must be even */
427 427
428 if (byteswap) { 428 if (byteswap) {
429 /* convert from big-endian to host byte order */ 429 /* convert from big-endian to host byte order */
430 for (p = end ; p != s;) 430 for (p = s ; p != end ; p += 2)
431 be16_to_cpus((u16 *)(p -= 2)); 431 be16_to_cpus((u16 *) p);
432 } 432 }
433
433 /* strip leading blanks */ 434 /* strip leading blanks */
435 p = s;
434 while (s != end && *s == ' ') 436 while (s != end && *s == ' ')
435 ++s; 437 ++s;
436 /* compress internal blanks and strip trailing blanks */ 438 /* compress internal blanks and strip trailing blanks */