soc: qcom: apr: Add check for idr_alloc and of_property_read_string_index
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Mon, 7 Nov 2022 01:44:03 +0000 (09:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:13:57 +0000 (13:13 +0100)
commit0f9ac041911deb48c062718b65219f957da7b26a
treeb6a6f0aa6d275fad795292a984acfc414c98ed43
parent6855dd02c55d7fb0af8991586ae06d57c92f6323
soc: qcom: apr: Add check for idr_alloc and of_property_read_string_index

[ Upstream commit 6d7860f5750d73da2fa1a1f6c9405058a593fa32 ]

As idr_alloc() and of_property_read_string_index() can return negative
numbers, it should be better to check the return value and deal with
the exception.
Therefore, it should be better to use goto statement to stop and return
error.

Fixes: 6adba21eb434 ("soc: qcom: Add APR bus driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20221107014403.3606-1-jiasheng@iscas.ac.cn
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/soc/qcom/apr.c