[MTD] mtdoops cleanup
authorPeter Korsgaard <jacmet@sunsite.dk>
Tue, 6 Nov 2007 10:56:02 +0000 (11:56 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Mon, 3 Dec 2007 14:00:16 +0000 (14:00 +0000)
Use memcpy instead of open coding a copy loop.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
drivers/mtd/mtdoops.c

index f8af627f0b98e68d2392039c2f4f918a3db842b5..20eaf294f620150d20a916dc3c7977c9836892a2 100644 (file)
@@ -286,7 +286,6 @@ mtdoops_console_write(struct console *co, const char *s, unsigned int count)
 {
        struct mtdoops_context *cxt = co->data;
        struct mtd_info *mtd = cxt->mtd;
-       int i;
 
        if (!oops_in_progress) {
                mtdoops_console_sync();
@@ -305,10 +304,8 @@ mtdoops_console_write(struct console *co, const char *s, unsigned int count)
        if ((count + cxt->writecount) > OOPS_PAGE_SIZE)
                count = OOPS_PAGE_SIZE - cxt->writecount;
 
-       for (i = 0; i < count; i++, s++)
-               *((char *)(cxt->oops_buf) + cxt->writecount + i) = *s;
-
-       cxt->writecount = cxt->writecount + count;
+       memcpy(cxt->oops_buf + cxt->writecount, s, count);
+       cxt->writecount += count;
 }
 
 static int __init mtdoops_console_setup(struct console *co, char *options)