diff options
author | Kang Chen <void0red@gmail.com> | 2023-02-27 08:41:16 +0800 |
---|---|---|
committer | Bjorn Andersson <andersson@kernel.org> | 2023-07-15 12:57:29 -0700 |
commit | 3c81195a04e13833196462ab398d8bcf282701f7 (patch) | |
tree | cab3c5700c3301e45751df87a7920fab0f92ccf7 /drivers/hwspinlock | |
parent | 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5 (diff) |
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>
Diffstat (limited to 'drivers/hwspinlock')
-rw-r--r-- | drivers/hwspinlock/qcom_hwspinlock.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom_hwspinlock.c index 9cf186362ae2..dee7bb5eae38 100644 --- a/drivers/hwspinlock/qcom_hwspinlock.c +++ b/drivers/hwspinlock/qcom_hwspinlock.c @@ -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, |