Skip to content

Commit e327017

Browse files
mukeshojha-linuxandersson
authored andcommitted
firmware: qcom_scm: don't opencode kmemdup
Lets not opencode kmemdup which is reported by coccinelle tool. Fix it using kmemdup. cocci warnings: (new ones prefixed by >>) >> drivers/firmware/qcom/qcom_scm.c:916:11-18: WARNING opportunity for kmemdup Fixes: 8b9d205 ("firmware: qcom_scm: Add qcom_scm_pas_get_rsc_table() to get resource table") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202601142144.HvSlBSI9-lkp@intel.com/ Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260310140255.2520230-1-mukesh.ojha@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
1 parent 678647c commit e327017

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/firmware/qcom/qcom_scm.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,14 +922,13 @@ struct resource_table *qcom_scm_pas_get_rsc_table(struct qcom_scm_pas_context *c
922922
goto free_input_rt;
923923
}
924924

925-
tbl_ptr = kzalloc(size, GFP_KERNEL);
925+
tbl_ptr = kmemdup(output_rt_tzm, size, GFP_KERNEL);
926926
if (!tbl_ptr) {
927927
qcom_tzmem_free(output_rt_tzm);
928928
ret = -ENOMEM;
929929
goto free_input_rt;
930930
}
931931

932-
memcpy(tbl_ptr, output_rt_tzm, size);
933932
*output_rt_size = size;
934933
qcom_tzmem_free(output_rt_tzm);
935934

0 commit comments

Comments
 (0)