mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-14 00:47:26 +00:00
button: qcom-pmic: fix some error checking
The pmic_reg_read() function can return errors. Add a check for that.
Fixes: 4e8aa0065d
("button: qcom-pmic: introduce Qualcomm PMIC button driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
This commit is contained in:
parent
37345abb97
commit
6b929e9f3c
1 changed files with 1 additions and 1 deletions
|
@ -86,7 +86,7 @@ static int qcom_pwrkey_probe(struct udevice *dev)
|
|||
}
|
||||
|
||||
ret = pmic_reg_read(priv->pmic, priv->base + REG_SUBTYPE);
|
||||
if ((ret & 0x7) == 0) {
|
||||
if (ret < 0 || (ret & 0x7) == 0) {
|
||||
printf("%s: unexpected PMCI function subtype %d\n", dev->name, ret);
|
||||
return -ENXIO;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue