staging/atomisp: reduce load_primary_binaries() stack usage
Subsystems (4)
PATCH 1/1 staging/atomisp: reduce load_primary_binaries() stack usage
From: Arnd Bergmann <[email protected]>
The load_primary_binaries() function is overly complex and has som large variables on the stack, which can cause warnings depending on CONFIG_FRAME_WARN setting:
drivers/staging/media/atomisp/pci/sh_css.c: In function 'load_primary_binaries':drivers/staging/media/atomisp/pci/sh_css.c:5260:1: error: the frame size of 1560 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
Half of the stack usage is for the prim_descr[] array, but only one member of the array is used at any given time.
Reduce the stack usage by turning the array into a single structure.
--- drivers/staging/media/atomisp/pci/sh_css.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/media/atomisp/pci/sh_css.c +3 -3
@@ -5020,7 +5020,6 @@ static int load_primary_binaries(struct ia_css_capture_settings *mycs;unsigned int i;bool need_extra_yuv_scaler = false; -struct ia_css_binary_descr prim_descr[MAX_NUM_PRIMARY_STAGES ];IA_CSS_ENTER_PRIVATE ("" );assert (pipe);
@@ -5189,15 +5188,16 @@ static int load_primary_binaries(/* Primary */ for (i =0 ; i < mycs->num_primary_stage; i++) { +struct ia_css_binary_descr prim_descr;struct ia_css_frame_info *local_vf_info =NULL ;if (pipe->enable_viewfinder[IA_CSS_PIPE_OUTPUT_STAGE_0 ] && (i == mycs->num_primary_stage -1 )) local_vf_info = &vf_info; -ia_css_pipe_get_primary_binarydesc (pipe, &prim_descr[i], +ia_css_pipe_get_primary_binarydesc (pipe, &prim_descr, &prim_in_info, &prim_out_info, local_vf_info, i); - err =ia_css_binary_find (&prim_descr[i], &mycs->primary_binary[i]); + err =ia_css_binary_find (&prim_descr, &mycs->primary_binary[i]);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err;
Signature · 1 line
2.39.5
Quoted 1 line · Arnd Bergmann
The
load_primary_binaries()function is overly complex and has som large
some
Quoted 10 lines
variables on the stack, which can cause warnings depending on
CONFIG_FRAME_WARNsetting:
drivers/staging/media/atomisp/pci/sh_css.c: In function 'load_primary_binaries':drivers/staging/media/atomisp/pci/sh_css.c:5260:1: error: the frame size of 1560 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]Half of the stack usage is for the prim_descr[] array, but only one member of the array is used at any given time.
Reduce the stack usage by turning the array into a single structure.
Makes sense,
*I think the original idea was to construct some chains out of the firmware blobs and provide run-time combinations of them, but IIRC that was never implemented.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Sakari Ailus
reviewerQuoted 15 lines · Andy Shevchenko
Quoted 1 line · Arnd Bergmann
The
load_primary_binaries()function is overly complex and has som largesome
Quoted 9 lines
variables on the stack, which can cause warnings depending on
CONFIG_FRAME_WARNsetting:
drivers/staging/media/atomisp/pci/sh_css.c: In function 'load_primary_binaries':drivers/staging/media/atomisp/pci/sh_css.c:5260:1: error: the frame size of 1560 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]Half of the stack usage is for the prim_descr[] array, but only one member of the array is used at any given time.
Quoted 8 lines
Quoted 1 line
Reduce the stack usage by turning the array into a single structure.
Makes sense,
Reviewed-by Andy Shevchenko <[email protected]>*I think the original idea was to construct some chains out of the firmware blobs and provide run-time combinations of them, but IIRC that was never implemented.
Thanks.
I'll add Cc: stable to make CI happy and this can't hurt in the stable trees anyway.
Signature · 1 line
Sakari Ailus