Skip to content

Commit

Permalink
[MTD] mtdoops cleanup
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Korsgaard authored and David Woodhouse committed Dec 3, 2007
1 parent 256331d commit 235d620
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/mtd/mtdoops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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)
Expand Down

0 comments on commit 235d620

Please sign in to comment.