Commit d2f3009e authored by Martiros Shakhzadyan's avatar Martiros Shakhzadyan Committed by Mauro Carvalho Chehab

media: atomisp: Use kcalloc instead of kzalloc with multiply in sh_css.c

Use kcalloc instead of kzalloc with multiplication.

Link: https://lore.kernel.org/linux-media/20210508235622.300394-4-vrzh@vrzh.netSigned-off-by: default avatarMartiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent a93cf5a5
...@@ -5328,14 +5328,15 @@ static int load_video_binaries(struct ia_css_pipe *pipe) ...@@ -5328,14 +5328,15 @@ static int load_video_binaries(struct ia_css_pipe *pipe)
if (err) if (err)
return err; return err;
mycs->num_yuv_scaler = cas_scaler_descr.num_stage; mycs->num_yuv_scaler = cas_scaler_descr.num_stage;
mycs->yuv_scaler_binary = kzalloc(cas_scaler_descr.num_stage * mycs->yuv_scaler_binary = kcalloc(cas_scaler_descr.num_stage,
sizeof(struct ia_css_binary), GFP_KERNEL); sizeof(struct ia_css_binary),
GFP_KERNEL);
if (!mycs->yuv_scaler_binary) { if (!mycs->yuv_scaler_binary) {
err = -ENOMEM; err = -ENOMEM;
return err; return err;
} }
mycs->is_output_stage = kzalloc(cas_scaler_descr.num_stage mycs->is_output_stage = kcalloc(cas_scaler_descr.num_stage,
* sizeof(bool), GFP_KERNEL); sizeof(bool), GFP_KERNEL);
if (!mycs->is_output_stage) { if (!mycs->is_output_stage) {
err = -ENOMEM; err = -ENOMEM;
return err; return err;
...@@ -5938,14 +5939,15 @@ static int load_primary_binaries( ...@@ -5938,14 +5939,15 @@ static int load_primary_binaries(
return err; return err;
} }
mycs->num_yuv_scaler = cas_scaler_descr.num_stage; mycs->num_yuv_scaler = cas_scaler_descr.num_stage;
mycs->yuv_scaler_binary = kzalloc(cas_scaler_descr.num_stage * mycs->yuv_scaler_binary = kcalloc(cas_scaler_descr.num_stage,
sizeof(struct ia_css_binary), GFP_KERNEL); sizeof(struct ia_css_binary),
GFP_KERNEL);
if (!mycs->yuv_scaler_binary) { if (!mycs->yuv_scaler_binary) {
err = -ENOMEM; err = -ENOMEM;
IA_CSS_LEAVE_ERR_PRIVATE(err); IA_CSS_LEAVE_ERR_PRIVATE(err);
return err; return err;
} }
mycs->is_output_stage = kzalloc(cas_scaler_descr.num_stage * mycs->is_output_stage = kcalloc(cas_scaler_descr.num_stage,
sizeof(bool), GFP_KERNEL); sizeof(bool), GFP_KERNEL);
if (!mycs->is_output_stage) { if (!mycs->is_output_stage) {
err = -ENOMEM; err = -ENOMEM;
...@@ -6989,14 +6991,14 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) ...@@ -6989,14 +6991,14 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe)
goto ERR; goto ERR;
mycs->num_output = cas_scaler_descr.num_output_stage; mycs->num_output = cas_scaler_descr.num_output_stage;
mycs->num_yuv_scaler = cas_scaler_descr.num_stage; mycs->num_yuv_scaler = cas_scaler_descr.num_stage;
mycs->yuv_scaler_binary = kzalloc(cas_scaler_descr.num_stage * mycs->yuv_scaler_binary = kcalloc(cas_scaler_descr.num_stage,
sizeof(struct ia_css_binary), sizeof(struct ia_css_binary),
GFP_KERNEL); GFP_KERNEL);
if (!mycs->yuv_scaler_binary) { if (!mycs->yuv_scaler_binary) {
err = -ENOMEM; err = -ENOMEM;
goto ERR; goto ERR;
} }
mycs->is_output_stage = kzalloc(cas_scaler_descr.num_stage * mycs->is_output_stage = kcalloc(cas_scaler_descr.num_stage,
sizeof(bool), GFP_KERNEL); sizeof(bool), GFP_KERNEL);
if (!mycs->is_output_stage) { if (!mycs->is_output_stage) {
err = -ENOMEM; err = -ENOMEM;
...@@ -7097,7 +7099,7 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) ...@@ -7097,7 +7099,7 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe)
mycs->num_vf_pp = 1; mycs->num_vf_pp = 1;
} }
mycs->vf_pp_binary = kzalloc(mycs->num_vf_pp * mycs->vf_pp_binary = kcalloc(mycs->num_vf_pp,
sizeof(struct ia_css_binary), sizeof(struct ia_css_binary),
GFP_KERNEL); GFP_KERNEL);
if (!mycs->vf_pp_binary) { if (!mycs->vf_pp_binary) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment