summaryrefslogtreecommitdiff
path: root/drivers/phy
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2022-10-14 12:25:06 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-11-16 11:57:08 +0300
commit72ea2fc29962f3bb16eba80a2f0c88ffa6bb9e08 (patch)
treebf3b589e5fd62fd55f979043da08aa625c372690 /drivers/phy
parent925bf1ba760482591218ace2c8fe135155da2710 (diff)
downloadlinux-72ea2fc29962f3bb16eba80a2f0c88ffa6bb9e08.tar.xz
phy: stm32: fix an error code in probe
[ Upstream commit ca1c73628f5bd0c1ef6e46073cc3be2450605b06 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/phy')
-rw-r--r--drivers/phy/st/phy-stm32-usbphyc.c2
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 2b3639cba51a..03fc567e9f18 100644
--- a/drivers/phy/st/phy-stm32-usbphyc.c
+++ b/drivers/phy/st/phy-stm32-usbphyc.c
@@ -393,6 +393,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;
}