提交 e1990222 编写于 作者: H Hari Prasath 提交者: Mauro Carvalho Chehab

media: staging: atomisp: use kstrdup to replace kmalloc and memcpy

kstrdup kernel primitive can be used to replace kmalloc followed by
string copy. This was reported by coccinelle tool.
Signed-off-by: NHari Prasath <gehariprasath@gmail.com>
Signed-off-by: NSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
上级 e9e8c1cd
......@@ -131,14 +131,10 @@ sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi, struct ia
if (bi->type == ia_css_isp_firmware || bi->type == ia_css_sp_firmware) {
char *namebuffer;
int namelength = (int)strlen(name);
namebuffer = (char *) kmalloc(namelength + 1, GFP_KERNEL);
if (namebuffer == NULL)
namebuffer = kstrdup(name, GFP_KERNEL);
if (!namebuffer)
return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
memcpy(namebuffer, name, namelength + 1);
bd->name = fw_minibuffer[index].name = namebuffer;
} else {
bd->name = name;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册