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

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 <christophe.jaillet@wanadoo.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Christophe JAILLET and committed by
Greg Kroah-Hartman
49ca2eff a1279ef7

+2
+2
drivers/usb/chipidea/ci_hdrc_usb2.c
··· 52 52 53 53 if (!ci_pdata) { 54 54 ci_pdata = devm_kmalloc(dev, sizeof(*ci_pdata), GFP_KERNEL); 55 + if (!ci_pdata) 56 + return -ENOMEM; 55 57 *ci_pdata = ci_default_pdata; /* struct copy */ 56 58 } 57 59