[PATCH] sisusbvga: use proper device for dev_err() during probe

From: Nickolai Zeldovich
Date: Mon Jan 07 2013 - 21:36:57 EST

If kzalloc returns NULL, do not dereference the said NULL pointer as the
first argument to dev_err(); use &dev->dev instead. Similarly, before
sisusb->sisusb_dev has been initialized to dev, use dev_err(&dev->dev)

Signed-off-by: Nickolai Zeldovich <nickolai@xxxxxxxxxxxxx>
drivers/usb/misc/sisusbvga/sisusb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index dd573ab..bf5f12c 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -3084,7 +3084,7 @@ static int sisusb_probe(struct usb_interface *intf,

/* Allocate memory for our private */
if (!(sisusb = kzalloc(sizeof(*sisusb), GFP_KERNEL))) {
- dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for private data\n");
+ dev_err(&dev->dev, "Failed to allocate memory for private data\n");
return -ENOMEM;
@@ -3093,7 +3093,7 @@ static int sisusb_probe(struct usb_interface *intf,

/* Register device */
if ((retval = usb_register_dev(intf, &usb_sisusb_class))) {
- dev_err(&sisusb->sisusb_dev->dev, "Failed to get a minor for device %d\n",
+ dev_err(&dev->dev, "Failed to get a minor for device %d\n",
retval = -ENODEV;
goto error_1;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/