Skip to content

Commit ca1c736

Browse files
Dan Carpentervinodkoul
authored andcommitted
phy: stm32: fix an error code in probe
If "index > usbphyc->nphys" is true then this returns success but it should return -EINVAL. Fixes: 94c358d ("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>
1 parent 76845ba commit ca1c736

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/phy/st/phy-stm32-usbphyc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,8 @@ static int stm32_usbphyc_probe(struct platform_device *pdev)
710710
ret = of_property_read_u32(child, "reg", &index);
711711
if (ret || index > usbphyc->nphys) {
712712
dev_err(&phy->dev, "invalid reg property: %d\n", ret);
713+
if (!ret)
714+
ret = -EINVAL;
713715
goto put_child;
714716
}
715717

0 commit comments

Comments
 (0)