Skip to contentSkip to conversation

drivers/net/mac8390.c: Remove useless memcpy casting

DISCUSSION Geert Uytterhoeven 2 participants 2 messages Mar 7, 2010 – Mar 8, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

drivers/net/mac8390.c static enum mac8390_access __init mac8390_testio(volatile unsigned long membase)

Quoted 21 lines · Linux Kernel Mailing List

Gitweb:     http://git.kernel.org/linus/5c7fffd0e3b57cb63f50bbd710868f012d67654f
Commit:     5c7fffd0e3b57cb63f50bbd710868f012d67654f
Parent:     35076402a9936fa8a73b57a1f97fecbeceeec34a
Author:     Joe Perches <[email protected]>
AuthorDate: Mon Jan 4 11:53:00 2010 +0000
Committer:  David S. Miller <[email protected]>
CommitDate: Wed Jan 6 20:44:02 2010 -0800

   drivers/net/mac8390.c: Remove useless memcpy casting

---
 drivers/net/mac8390.c |   19 ++++++++++---------

 1 files changed, 10 insertions(+), 9 deletions(-)
drivers/net/mac8390.c +0 -0
index 6b6f375..517cee4 100644
@@ -237,14 +237,14 @@ static enum mac8390_access __init mac8390_testio(volatile unsigned long membase)

As indicated by the prototype above, membase is not a pointer...

Quoted 7 lines
drivers/net/mac8390.c +1 -1
        unsigned long outdata = 0xA5A0B5B0;
        unsigned long indata =  0x00000000;
        /* Try writing 32 bits */
-       memcpy((char *)membase, (char *)&outdata, 4);
+       memcpy(membase, &outdata, 4);
        /* Now compare them */
        if (memcmp((char *)&outdata, (char *)membase, 4) == 0)

drivers/net/mac8390.c static enum mac8390_access __init mac8390_testio(volatile unsigned long membase) · line 250

Quoted 10 lines
drivers/net/mac8390.c +2 -2
                return ACCESS_32;
        /* Write 16 bit output */
-       word_memcpy_tocard((char *)membase, (char *)&outdata, 4);
+       word_memcpy_tocard(membase, &outdata, 4);
        /* Now read it back */
-       word_memcpy_fromcard((char *)&indata, (char *)membase, 4);
+       word_memcpy_fromcard(&indata, membase, 4);
        if (outdata == indata)
                return ACCESS_16;
        return ACCESS_UNKNOWN;

... hence you introduced 3 compiler warnings:

drivers/net/mac8390.c:249: warning: passing argument 1 of '__builtin_memcpy' makes pointer from integer without a cast drivers/net/mac8390.c:254: warning: passing argument 1 of 'word_memcpy_tocard' makes pointer from integer without a cast drivers/net/mac8390.c:256: warning: passing argument 2 of 'word_memcpy_fromcard' makes pointer from integer without a cast

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#2 lore raw
Quoted 8 lines · Geert Uytterhoeven

... hence you introduced 3 compiler warnings:

drivers/net/mac8390.c:249: warning: passing argument 1 of '__builtin_memcpy' makes pointer from integer without a cast drivers/net/mac8390.c:254: warning: passing argument 1 of 'word_memcpy_tocard' makes pointer from integer without a cast drivers/net/mac8390.c:256: warning: passing argument 2 of 'word_memcpy_fromcard' makes pointer from integer without a cast

Thanks, I'll submit a patch to fix it by tomorrow or so.