diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-10-14 11:25:06 +0200 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2022-10-17 07:25:26 +0200 |
commit | ca1c73628f5bd0c1ef6e46073cc3be2450605b06 (patch) | |
tree | f5c31db8e7cdd49078d239153760c86a1771b9c9 /drivers/phy/st | |
parent | MAINTAINERS: Update Kishon's email address in GENERIC PHY FRAMEWORK (diff) | |
download | linux-ca1c73628f5bd0c1ef6e46073cc3be2450605b06.tar.xz linux-ca1c73628f5bd0c1ef6e46073cc3be2450605b06.zip |
phy: stm32: fix an error code in probe
If "index > usbphyc->nphys" is true then this returns success but it
should return -EINVAL.
Fixes: 94c358da3a05 ("phy: stm32: add support for STM32 USB PHY Controller (USBPHYC)")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/r/Y0kq8j6S+5nDdMpr@kili
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/phy/st')
-rw-r--r-- | drivers/phy/st/phy-stm32-usbphyc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/phy/st/phy-stm32-usbphyc.c b/drivers/phy/st/phy-stm32-usbphyc.c index a98c911cc37a..5bb9647b078f 100644 --- a/drivers/phy/st/phy-stm32-usbphyc.c +++ b/drivers/phy/st/phy-stm32-usbphyc.c @@ -710,6 +710,8 @@ static int stm32_usbphyc_probe(struct platform_device *pdev) ret = of_property_read_u32(child, "reg", &index); if (ret || index > usbphyc->nphys) { dev_err(&phy->dev, "invalid reg property: %d\n", ret); + if (!ret) + ret = -EINVAL; goto put_child; } |