hwspinlock: add a check of devm_regmap_field_alloc in qcom_hwspinlock_probe

devm_regmap_field_alloc may fails, priv field might be error pointer and
cause illegal address access later.

Signed-off-by: Kang Chen <void0red@gmail.com>
Link: https://lore.kernel.org/r/20230227004116.1273988-1-void0red@gmail.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
This commit is contained in:
Kang Chen 2023-02-27 08:41:16 +08:00 committed by Bjorn Andersson
parent 06c2afb862
commit 3c81195a04

View File

@ -197,6 +197,8 @@ static int qcom_hwspinlock_probe(struct platform_device *pdev)
bank->lock[i].priv = devm_regmap_field_alloc(&pdev->dev,
regmap, field);
if (IS_ERR(bank->lock[i].priv))
return PTR_ERR(bank->lock[i].priv);
}
return devm_hwspin_lock_register(&pdev->dev, bank, &qcom_hwspinlock_ops,