aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-01-20 02:42:42 -0500
committerTakashi Iwai <tiwai@suse.de>2015-01-28 01:19:37 -0500
commit8a3b7c086a509d90c312ebab6d8e5a9bf48c6cf5 (patch)
tree89c8dd81edfc0148e3c5a5a54aa93892739e58db /sound/usb
parent2a324fcdb568f4d7b0b65b271039beb987f6e1cd (diff)
ALSA: line6: Remove superfluous NULL checks in each driver
The interface and driver objects are always set when callbacks are called. Drop such superfluous NULL checks in init and disconnect calls of each driver. Tested-by: Chris Rorvick <chris@rorvick.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/line6/pod.c28
-rw-r--r--sound/usb/line6/podhd.c4
-rw-r--r--sound/usb/line6/toneport.c6
-rw-r--r--sound/usb/line6/variax.c8
4 files changed, 8 insertions, 38 deletions
diff --git a/sound/usb/line6/pod.c b/sound/usb/line6/pod.c
index bf027fc70cba..26ecf26a33ec 100644
--- a/sound/usb/line6/pod.c
+++ b/sound/usb/line6/pod.c
@@ -401,25 +401,16 @@ static struct snd_kcontrol_new pod_control_monitor = {
401*/ 401*/
402static void line6_pod_disconnect(struct usb_interface *interface) 402static void line6_pod_disconnect(struct usb_interface *interface)
403{ 403{
404 struct usb_line6_pod *pod; 404 struct usb_line6_pod *pod = usb_get_intfdata(interface);
405 405 struct device *dev = &interface->dev;
406 if (interface == NULL)
407 return;
408 pod = usb_get_intfdata(interface);
409
410 if (pod != NULL) {
411 struct device *dev = &interface->dev;
412 406
413 if (dev != NULL) { 407 /* remove sysfs entries: */
414 /* remove sysfs entries: */ 408 device_remove_file(dev, &dev_attr_device_id);
415 device_remove_file(dev, &dev_attr_device_id); 409 device_remove_file(dev, &dev_attr_firmware_version);
416 device_remove_file(dev, &dev_attr_firmware_version); 410 device_remove_file(dev, &dev_attr_serial_number);
417 device_remove_file(dev, &dev_attr_serial_number);
418 }
419 411
420 del_timer_sync(&pod->startup_timer); 412 del_timer_sync(&pod->startup_timer);
421 cancel_work_sync(&pod->startup_work); 413 cancel_work_sync(&pod->startup_work);
422 }
423} 414}
424 415
425/* 416/*
@@ -456,9 +447,6 @@ static int pod_init(struct usb_interface *interface,
456 init_timer(&pod->startup_timer); 447 init_timer(&pod->startup_timer);
457 INIT_WORK(&pod->startup_work, pod_startup4); 448 INIT_WORK(&pod->startup_work, pod_startup4);
458 449
459 if ((interface == NULL) || (pod == NULL))
460 return -ENODEV;
461
462 /* create sysfs entries: */ 450 /* create sysfs entries: */
463 err = pod_create_files2(&interface->dev); 451 err = pod_create_files2(&interface->dev);
464 if (err < 0) 452 if (err < 0)
diff --git a/sound/usb/line6/podhd.c b/sound/usb/line6/podhd.c
index 7217fa7e5db1..59abbd92624e 100644
--- a/sound/usb/line6/podhd.c
+++ b/sound/usb/line6/podhd.c
@@ -90,12 +90,8 @@ static struct line6_pcm_properties podhd_pcm_properties = {
90static int podhd_init(struct usb_interface *interface, 90static int podhd_init(struct usb_interface *interface,
91 struct usb_line6 *line6) 91 struct usb_line6 *line6)
92{ 92{
93 struct usb_line6_podhd *podhd = (struct usb_line6_podhd *) line6;
94 int err; 93 int err;
95 94
96 if ((interface == NULL) || (podhd == NULL))
97 return -ENODEV;
98
99 /* initialize MIDI subsystem: */ 95 /* initialize MIDI subsystem: */
100 err = line6_init_midi(line6); 96 err = line6_init_midi(line6);
101 if (err < 0) 97 if (err < 0)
diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c
index c1f61cde52ab..e5669bd3233a 100644
--- a/sound/usb/line6/toneport.c
+++ b/sound/usb/line6/toneport.c
@@ -370,9 +370,6 @@ static void line6_toneport_disconnect(struct usb_interface *interface)
370 struct usb_line6_toneport *toneport; 370 struct usb_line6_toneport *toneport;
371 u16 idProduct; 371 u16 idProduct;
372 372
373 if (interface == NULL)
374 return;
375
376 toneport = usb_get_intfdata(interface); 373 toneport = usb_get_intfdata(interface);
377 del_timer_sync(&toneport->timer); 374 del_timer_sync(&toneport->timer);
378 idProduct = le16_to_cpu(toneport->line6.usbdev->descriptor.idProduct); 375 idProduct = le16_to_cpu(toneport->line6.usbdev->descriptor.idProduct);
@@ -393,9 +390,6 @@ static int toneport_init(struct usb_interface *interface,
393 int err; 390 int err;
394 struct usb_line6_toneport *toneport = (struct usb_line6_toneport *) line6; 391 struct usb_line6_toneport *toneport = (struct usb_line6_toneport *) line6;
395 392
396 if ((interface == NULL) || (toneport == NULL))
397 return -ENODEV;
398
399 line6->disconnect = line6_toneport_disconnect; 393 line6->disconnect = line6_toneport_disconnect;
400 394
401 /* initialize PCM subsystem: */ 395 /* initialize PCM subsystem: */
diff --git a/sound/usb/line6/variax.c b/sound/usb/line6/variax.c
index 99a58cbfd2da..cd3adeffde02 100644
--- a/sound/usb/line6/variax.c
+++ b/sound/usb/line6/variax.c
@@ -214,12 +214,7 @@ static void line6_variax_disconnect(struct usb_interface *interface)
214{ 214{
215 struct usb_line6_variax *variax; 215 struct usb_line6_variax *variax;
216 216
217 if (!interface)
218 return;
219
220 variax = usb_get_intfdata(interface); 217 variax = usb_get_intfdata(interface);
221 if (!variax)
222 return;
223 218
224 del_timer(&variax->startup_timer1); 219 del_timer(&variax->startup_timer1);
225 del_timer(&variax->startup_timer2); 220 del_timer(&variax->startup_timer2);
@@ -244,9 +239,6 @@ static int variax_init(struct usb_interface *interface,
244 init_timer(&variax->startup_timer2); 239 init_timer(&variax->startup_timer2);
245 INIT_WORK(&variax->startup_work, variax_startup6); 240 INIT_WORK(&variax->startup_work, variax_startup6);
246 241
247 if ((interface == NULL) || (variax == NULL))
248 return -ENODEV;
249
250 /* initialize USB buffers: */ 242 /* initialize USB buffers: */
251 variax->buffer_activate = kmemdup(variax_activate, 243 variax->buffer_activate = kmemdup(variax_activate,
252 sizeof(variax_activate), GFP_KERNEL); 244 sizeof(variax_activate), GFP_KERNEL);