On Mon, Jun 05, 2023 at 06:29:02PM +0800, Kate Hsuan wrote: > Pick up the necessary part of sp_group configuration for both model and > then copy those parts into a tempetory buffer. This buffer is finally > written to the ISP with correct length. > > Signed-off-by: Kate Hsuan <hpa@xxxxxxxxxx> > --- > .../staging/media/atomisp/pci/sh_css_params.c | 37 ++++++++++++++++++- > 1 file changed, 35 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c > index 588f2adab058..2913d9d6d226 100644 > --- a/drivers/staging/media/atomisp/pci/sh_css_params.c > +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c > @@ -3720,10 +3720,43 @@ struct ia_css_shading_table *ia_css_get_shading_table(struct ia_css_stream > > ia_css_ptr sh_css_store_sp_group_to_ddr(void) > { > + u8 *write_buf; > + u8 *buf_ptr; > + > IA_CSS_ENTER_LEAVE_PRIVATE("void"); > + > + write_buf = kzalloc(sizeof(u8) * 8192, GFP_KERNEL); Please add a check for allocation failure. regards, dan carpenter > + > + buf_ptr = write_buf; > + if (IS_ISP2401) { > + memcpy(buf_ptr, &sh_css_sp_group.config, sizeof(u8) * 5); > + buf_ptr += (sizeof(u8) * 5); > + memset(buf_ptr, 0, 3); > + buf_ptr += 3; /* Padding 3 bytes for struct sh_css_sp_config*/ > + } else { > + memcpy(buf_ptr, &sh_css_sp_group.config, sizeof(sh_css_sp_group.config)); > + buf_ptr += sizeof(sh_css_sp_group.config); > + }