soc: qcom: rpmpd: Check for null return of devm_kcalloc
stable inclusion from stable-v5.10.110 commit b5d6eba71997b6d661935d2b15094ac7f9f6132d bugzilla: https://gitee.com/openeuler/kernel/issues/I574AL Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b5d6eba71997b6d661935d2b15094ac7f9f6132d -------------------------------- [ Upstream commit 5a811126 ] Because of the possible failure of the allocation, data->domains might be NULL pointer and will cause the dereference of the NULL pointer later. Therefore, it might be better to check it and directly return -ENOMEM without releasing data manually if fails, because the comment of the devm_kmalloc() says "Memory allocated with this function is automatically freed on driver detach.". Fixes: bbe3a66c ("soc: qcom: rpmpd: Add a Power domain driver to model corners") Signed-off-by: NJiasheng Jiang <jiasheng@iscas.ac.cn> Signed-off-by: NBjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20211231094419.1941054-1-jiasheng@iscas.ac.cnSigned-off-by: NSasha Levin <sashal@kernel.org> Signed-off-by: NYu Liao <liaoyu15@huawei.com> Reviewed-by: NWei Li <liwei391@huawei.com> Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Showing
想要评论请 注册 或 登录