diff options
author | Sean Anderson <seanga2@gmail.com> | 2022-03-23 14:26:09 -0400 |
---|---|---|
committer | Jaehoon Chung <jh80.chung@samsung.com> | 2022-04-22 21:19:21 +0900 |
commit | 847990219c04fe4d4b69deefdd29a2fb2d8171d9 (patch) | |
tree | d7f1764f867b41852cd57a3a6e15166faae5b3f5 | |
parent | ea5583b90f9c162af6f2025718dc50ffbb6e4552 (diff) | |
download | u-boot-847990219c04fe4d4b69deefdd29a2fb2d8171d9.zip u-boot-847990219c04fe4d4b69deefdd29a2fb2d8171d9.tar.gz u-boot-847990219c04fe4d4b69deefdd29a2fb2d8171d9.tar.bz2 |
power-domain: Fix use of uninitialized value in dev_power_domain_ctrl
If dev_count_phandle_with_args returns 0 or another error, then pd will never
have been initialized by power_domain_get_by_index. Avoid comparing against
pd.dev in this situation.
Fixes: 3e4fcfa4bc ("power-domain: fix hang in endless loop on i.MX8")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
-rw-r--r-- | drivers/power/domain/power-domain-uclass.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/power/domain/power-domain-uclass.c b/drivers/power/domain/power-domain-uclass.c index 33f9206..1a317a0 100644 --- a/drivers/power/domain/power-domain-uclass.c +++ b/drivers/power/domain/power-domain-uclass.c @@ -137,7 +137,7 @@ static int dev_power_domain_ctrl(struct udevice *dev, bool on) * off their power-domain parent. So we will get here again and * again and will be stuck in an endless loop. */ - if (!on && dev_get_parent(dev) == pd.dev && + if (count > 0 && !on && dev_get_parent(dev) == pd.dev && device_get_uclass_id(dev) == UCLASS_POWER_DOMAIN) return ret; |