From: Peter Senna Tschudin Date: Fri, 15 Jan 2016 17:41:34 +0000 (+0100) Subject: usb-misc: sisusbvga: fix error path X-Git-Tag: next-20160210~20^2~61 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0e781c2258ffb2a42bf44f62dea8662f38cbfd34;p=karo-tx-linux.git usb-misc: sisusbvga: fix error path Remove a call to dev_err() that was reporting an unsuccesful call to kmalloc(), as reporting memory allocation failures is redundant. Instead of logging the error, clean up previously allocated resources and abort the probe with -ENOMEM. Before this change sisusb->SiS_Pr could be dereferenced even if null after failure of memory allocation. Signed-off-by: Peter Senna Tschudin Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index b3713d57ce01..a22de52cb083 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c @@ -3112,7 +3112,8 @@ static int sisusb_probe(struct usb_interface *intf, /* Allocate our SiS_Pr */ sisusb->SiS_Pr = kmalloc(sizeof(struct SiS_Private), GFP_KERNEL); if (!sisusb->SiS_Pr) { - dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate SiS_Pr\n"); + retval = -ENOMEM; + goto error_4; } #endif