Commit 0f57576
pmdomain: core: Fix error checking in genpd_dev_pm_attach_by_id()
The error checking for of_count_phandle_with_args() does not handle
negative error codes correctly. The problem is that "index" is a u32 so
in the condition "if (index >= num_domains)" negative error codes stored
in "num_domains" are type promoted to very high positive values and
"index" is always going to be valid.
Test for negative error codes first and then test if "index" is valid.
Fixes: 3ccf3f0 ("PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM domain")
Signed-off-by: Dan Carpenter <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Ulf Hansson <[email protected]>1 parent 13a6d42 commit 0f57576
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3126 | 3126 | | |
3127 | 3127 | | |
3128 | 3128 | | |
3129 | | - | |
| 3129 | + | |
3130 | 3130 | | |
3131 | 3131 | | |
3132 | 3132 | | |
| |||
0 commit comments