[PATCH] mtd: rawnand: fix memdup.cocci warnings
From: Julia Lawall
Date: Fri Mar 02 2018 - 15:00:48 EST
From: Fengguang Wu <fengguang.wu@xxxxxxxxx>
Use kmemdup rather than duplicating its implementation
Generated by: scripts/coccinelle/api/memdup.cocci
Signed-off-by: Fengguang Wu <fengguang.wu@xxxxxxxxx>
Signed-off-buy: Julia Lawall <julia.lawall@xxxxxxx>
---
tree: https://github.com/bbrezillon/linux-0day mraynal/nand-scan
head: 0fdb0ec57e123aae03d1c52f8ba5fb6c8c8f98ed
commit: d4d20cd03273ee0d1bb874dc33170286216b6320 [70/71] mtd: rawnand: do
not export nand_scan_[ident|tail]() anymore
nand_base.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -5160,13 +5160,12 @@ static int nand_flash_detect_onfi(struct
sanitize_string(p->manufacturer, sizeof(p->manufacturer));
sanitize_string(p->model, sizeof(p->model));
- model = kzalloc(sizeof(p->model), GFP_KERNEL);
+ model = kmemdup(p->model, sizeof(p->model), GFP_KERNEL);
if (!model) {
ret = -ENOMEM;
goto free_onfi_param_page;
}
- memcpy(model, p->model, sizeof(p->model));
chip->parameters.model = model;
if (!mtd->name)
mtd->name = chip->parameters.model;