aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/garmin_gps.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/garmin_gps.c')
-rw-r--r--drivers/usb/serial/garmin_gps.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 04b5ed90ffb2..f4ee74da44e8 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -279,10 +279,9 @@ static int pkt_add(struct garmin_data *garmin_data_p,
279 if (data_length) { 279 if (data_length) {
280 pkt = kmalloc(sizeof(struct garmin_packet)+data_length, 280 pkt = kmalloc(sizeof(struct garmin_packet)+data_length,
281 GFP_ATOMIC); 281 GFP_ATOMIC);
282 if (pkt == NULL) { 282 if (!pkt)
283 dev_err(&garmin_data_p->port->dev, "out of memory\n");
284 return 0; 283 return 0;
285 } 284
286 pkt->size = data_length; 285 pkt->size = data_length;
287 memcpy(pkt->data, data, data_length); 286 memcpy(pkt->data, data, data_length);
288 287
@@ -1006,14 +1005,11 @@ static int garmin_write_bulk(struct usb_serial_port *port,
1006 spin_unlock_irqrestore(&garmin_data_p->lock, flags); 1005 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
1007 1006
1008 buffer = kmalloc(count, GFP_ATOMIC); 1007 buffer = kmalloc(count, GFP_ATOMIC);
1009 if (!buffer) { 1008 if (!buffer)
1010 dev_err(&port->dev, "out of memory\n");
1011 return -ENOMEM; 1009 return -ENOMEM;
1012 }
1013 1010
1014 urb = usb_alloc_urb(0, GFP_ATOMIC); 1011 urb = usb_alloc_urb(0, GFP_ATOMIC);
1015 if (!urb) { 1012 if (!urb) {
1016 dev_err(&port->dev, "no more free urbs\n");
1017 kfree(buffer); 1013 kfree(buffer);
1018 return -ENOMEM; 1014 return -ENOMEM;
1019 } 1015 }
@@ -1393,10 +1389,9 @@ static int garmin_port_probe(struct usb_serial_port *port)
1393 struct garmin_data *garmin_data_p; 1389 struct garmin_data *garmin_data_p;
1394 1390
1395 garmin_data_p = kzalloc(sizeof(struct garmin_data), GFP_KERNEL); 1391 garmin_data_p = kzalloc(sizeof(struct garmin_data), GFP_KERNEL);
1396 if (garmin_data_p == NULL) { 1392 if (!garmin_data_p)
1397 dev_err(&port->dev, "%s - Out of memory\n", __func__);
1398 return -ENOMEM; 1393 return -ENOMEM;
1399 } 1394
1400 init_timer(&garmin_data_p->timer); 1395 init_timer(&garmin_data_p->timer);
1401 spin_lock_init(&garmin_data_p->lock); 1396 spin_lock_init(&garmin_data_p->lock);
1402 INIT_LIST_HEAD(&garmin_data_p->pktlist); 1397 INIT_LIST_HEAD(&garmin_data_p->pktlist);