Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: dwc3: qcom: Fix error handling in probe

There are two issues:
1) Return -EINVAL if platform_get_resource() fails. Don't return
success.
2) The devm_ioremap() function doesn't return error pointers, it returns
NULL. Update the check.

Fixes: 1881a32fe14d ("usb: dwc3: qcom: Transition to flattened model")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/aAijmfAph0FlTqg6@stanley.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Dan Carpenter and committed by
Greg Kroah-Hartman
4c0fca65 45ebb7ba

+6 -4
+6 -4
drivers/usb/dwc3/dwc3-qcom.c
··· 740 740 } 741 741 742 742 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 743 - if (!r) 743 + if (!r) { 744 + ret = -EINVAL; 744 745 goto clk_disable; 746 + } 745 747 res = *r; 746 748 res.end = res.start + SDM845_QSCRATCH_BASE_OFFSET; 747 749 748 750 qcom->qscratch_base = devm_ioremap(dev, res.end, SDM845_QSCRATCH_SIZE); 749 - if (IS_ERR(qcom->qscratch_base)) { 750 - dev_err(dev, "failed to map qscratch region: %pe\n", qcom->qscratch_base); 751 - ret = PTR_ERR(qcom->qscratch_base); 751 + if (!qcom->qscratch_base) { 752 + dev_err(dev, "failed to map qscratch region\n"); 753 + ret = -ENOMEM; 752 754 goto clk_disable; 753 755 } 754 756