mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/4] mem: Fix memcpy_sz variable types
Date: Thu, 14 May 2015 12:21:21 +0200	[thread overview]
Message-ID: <1431598883-25668-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1431598883-25668-1-git-send-email-s.hauer@pengutronix.de>

- Drop usage of 'ulong', use unsigned long
- remove unnecessary intermediate casting to unsigned long
- Use proper u8/u16/u32 types. Fixes 64bit systems on which ulong is 64bit

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/fs.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index 779f264..a056d83 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1564,14 +1564,11 @@ out:
 }
 EXPORT_SYMBOL(rmdir);
 
-static void memcpy_sz(void *_dst, const void *_src, ulong count, ulong rwsize)
+static void memcpy_sz(void *dst, const void *src, size_t count, int rwsize)
 {
-	ulong dst = (ulong)_dst;
-	ulong src = (ulong)_src;
-
 	/* no rwsize specification given. Do whatever memcpy likes best */
 	if (!rwsize) {
-		memcpy(_dst, _src, count);
+		memcpy(dst, src, count);
 		return;
 	}
 
@@ -1582,13 +1579,13 @@ static void memcpy_sz(void *_dst, const void *_src, ulong count, ulong rwsize)
 	while (count-- > 0) {
 		switch (rwsize) {
 		case 1:
-			*((u_char *)dst) = *((u_char *)src);
+			*((u8 *)dst) = *((u8 *)src);
 			break;
 		case 2:
-			*((ushort *)dst) = *((ushort *)src);
+			*((u16 *)dst) = *((u16 *)src);
 			break;
 		case 4:
-			*((ulong  *)dst) = *((ulong  *)src);
+			*((u32  *)dst) = *((u32  *)src);
 			break;
 		}
 		dst += rwsize;
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2015-05-14 10:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14 10:21 [PATCH 1/4] i2c: Use correct format specifier Sascha Hauer
2015-05-14 10:21 ` Sascha Hauer [this message]
2015-05-14 10:21 ` [PATCH 3/4] mtd: Fix function prototype Sascha Hauer
2015-05-14 10:21 ` [PATCH 4/4] mtd: nand: Fix format specifier Sascha Hauer

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=1431598883-25668-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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