Skip to content

Commit

Permalink
phy: stm32: fix an error code in probe
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Vinod Koul committed Oct 17, 2022
1 parent 9abf231 commit f37722a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/phy/st/phy-stm32-usbphyc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit f37722a

Please sign in to comment.