From: Christophe JAILLET Date: Fri, 25 Aug 2017 05:22:53 +0000 (+0200) Subject: usb: chipidea: usb2: check memory allocation failure X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=49ca2eff5758eb73cc906dbea74ce54b7c99e4d1;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git usb: chipidea: usb2: check memory allocation failure Check memory allocation failure and return -ENOMEM in such a case, as already done few lines below for another memory allocation. Signed-off-by: Christophe JAILLET Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c index d162cc0bb8ce..99425db9ba62 100644 --- a/drivers/usb/chipidea/ci_hdrc_usb2.c +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c @@ -52,6 +52,8 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev) if (!ci_pdata) { ci_pdata = devm_kmalloc(dev, sizeof(*ci_pdata), GFP_KERNEL); + if (!ci_pdata) + return -ENOMEM; *ci_pdata = ci_default_pdata; /* struct copy */ }