Hello!
On 6/12/2018 7:32 AM, Zhouyang Jia wrote:
When platform_get_resource_byname fails, the lack of error-handling code may
cause unexpected results.
What results?
This patch adds error-handling code after calling platform_get_resource_byname.
Signed-off-by: Zhouyang Jia <jiazhouyang09@xxxxxxxxx>
---
drivers/usb/gadget/udc/r8a66597-udc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c
index a3ecce6..a7bd5e7 100644
--- a/drivers/usb/gadget/udc/r8a66597-udc.c
+++ b/drivers/usb/gadget/udc/r8a66597-udc.c
@@ -1830,6 +1830,11 @@ static int r8a66597_sudmac_ioremap(struct r8a66597 *r8a66597,
struct resource *res;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sudmac");
+ if (!res) {
+ dev_err(&pdev->dev, "could not allocate resource.\n");
+ return -ENODEV;
+ }
+
r8a66597->sudmac_reg = devm_ioremap_resource(&pdev->dev, res);
This function checks for 'res == NULL', no?
return PTR_ERR_OR_ZERO(r8a66597->sudmac_reg);
}
MBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html