Skip to content

Commit

Permalink
[media] drxd: Use kmemdup rather than duplicating its implementation
Browse files Browse the repository at this point in the history
The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Thomas Meyer authored and Mauro Carvalho Chehab committed Nov 24, 2011
1 parent d119002 commit 53090aa
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/media/dvb/frontends/drxd_hard.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,14 +914,13 @@ static int load_firmware(struct drxd_state *state, const char *fw_name)
return -EIO;
}

state->microcode = kmalloc(fw->size, GFP_KERNEL);
state->microcode = kmemdup(fw->data, fw->size, GFP_KERNEL);
if (state->microcode == NULL) {
release_firmware(fw);
printk(KERN_ERR "drxd: firmware load failure: no memory\n");
return -ENOMEM;
}

memcpy(state->microcode, fw->data, fw->size);
state->microcode_length = fw->size;
release_firmware(fw);
return 0;
Expand Down

0 comments on commit 53090aa

Please sign in to comment.