media: atomisp: avoid an extra memset() when alloc memory

Use the variant which zeroes the memory when allocating,
instead of having an explicit memset.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Mauro Carvalho Chehab 2020-05-28 09:17:28 +02:00
parent 6b673fdbd5
commit cadcec76ef
2 changed files with 2 additions and 4 deletions

View File

@ -593,12 +593,11 @@ static enum ia_css_err pipeline_stage_create(
out_frame[i] = stage_desc->out_frame[i]; out_frame[i] = stage_desc->out_frame[i];
} }
stage = kvmalloc(sizeof(*stage), GFP_KERNEL); stage = kvzalloc(sizeof(*stage), GFP_KERNEL);
if (!stage) { if (!stage) {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
goto ERR; goto ERR;
} }
memset(stage, 0, sizeof(*stage));
if (firmware) { if (firmware) {
stage->binary = NULL; stage->binary = NULL;

View File

@ -9400,7 +9400,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,
} }
/* allocate the stream instance */ /* allocate the stream instance */
curr_stream = kmalloc(sizeof(struct ia_css_stream), GFP_KERNEL); curr_stream = kzalloc(sizeof(struct ia_css_stream), GFP_KERNEL);
if (!curr_stream) if (!curr_stream)
{ {
err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY;
@ -9408,7 +9408,6 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,
return err; return err;
} }
/* default all to 0 */ /* default all to 0 */
memset(curr_stream, 0, sizeof(struct ia_css_stream));
curr_stream->info.metadata_info = md_info; curr_stream->info.metadata_info = md_info;
/* allocate pipes */ /* allocate pipes */