phy: stm32: fix an error code in probe
Subsystems (3)
PATCH 1/1 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 <[email protected]>
--- drivers/phy/st/phy-stm32-usbphyc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/phy/st/phy-stm32-usbphyc.c +2 -0
@@ -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; }
Signature · 7 lines
2.35.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Quoted 5 lines · Dan Carpenter
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 <[email protected]>
Thanks Dan,
Reviewed-by Amelie Delaunay <[email protected]>
Quoted 17 lines
--- drivers/phy/st/phy-stm32-usbphyc.c | 2 ++ 1 file changed, 2 insertions(+)drivers/phy/st/phy-stm32-usbphyc.c +2
-0@@ -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; }
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Quoted 2 lines · Dan Carpenter
If "index >
usbphyc->nphys" is true then this returns success but it should return-EINVAL.
Applied, thanks
Signature · 6 lines
~Vinod -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy