ALSA: line6: Remove superfluous NULL checks in each driver
authorTakashi Iwai <tiwai@suse.de>
Tue, 20 Jan 2015 07:42:42 +0000 (08:42 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 28 Jan 2015 06:19:37 +0000 (07:19 +0100)
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>
sound/usb/line6/pod.c
sound/usb/line6/podhd.c
sound/usb/line6/toneport.c
sound/usb/line6/variax.c

index bf027fc70cbad35368e0a862ec0a3e16d1fb500e..26ecf26a33ec64d90a3293b6358d5e0de07cbd37 100644 (file)
@@ -401,25 +401,16 @@ static struct snd_kcontrol_new pod_control_monitor = {
 */
 static void line6_pod_disconnect(struct usb_interface *interface)
 {
-       struct usb_line6_pod *pod;
-
-       if (interface == NULL)
-               return;
-       pod = usb_get_intfdata(interface);
-
-       if (pod != NULL) {
-               struct device *dev = &interface->dev;
+       struct usb_line6_pod *pod = usb_get_intfdata(interface);
+       struct device *dev = &interface->dev;
 
-               if (dev != NULL) {
-                       /* remove sysfs entries: */
-                       device_remove_file(dev, &dev_attr_device_id);
-                       device_remove_file(dev, &dev_attr_firmware_version);
-                       device_remove_file(dev, &dev_attr_serial_number);
-               }
+       /* remove sysfs entries: */
+       device_remove_file(dev, &dev_attr_device_id);
+       device_remove_file(dev, &dev_attr_firmware_version);
+       device_remove_file(dev, &dev_attr_serial_number);
 
-               del_timer_sync(&pod->startup_timer);
-               cancel_work_sync(&pod->startup_work);
-       }
+       del_timer_sync(&pod->startup_timer);
+       cancel_work_sync(&pod->startup_work);
 }
 
 /*
@@ -456,9 +447,6 @@ static int pod_init(struct usb_interface *interface,
        init_timer(&pod->startup_timer);
        INIT_WORK(&pod->startup_work, pod_startup4);
 
-       if ((interface == NULL) || (pod == NULL))
-               return -ENODEV;
-
        /* create sysfs entries: */
        err = pod_create_files2(&interface->dev);
        if (err < 0)
index 7217fa7e5db13464cd66761c6afc50990cb15a5c..59abbd92624ea49ce7cfd1289f7a5fe2e7b6f540 100644 (file)
@@ -90,12 +90,8 @@ static struct line6_pcm_properties podhd_pcm_properties = {
 static int podhd_init(struct usb_interface *interface,
                      struct usb_line6 *line6)
 {
-       struct usb_line6_podhd *podhd = (struct usb_line6_podhd *) line6;
        int err;
 
-       if ((interface == NULL) || (podhd == NULL))
-               return -ENODEV;
-
        /* initialize MIDI subsystem: */
        err = line6_init_midi(line6);
        if (err < 0)
index c1f61cde52ab9451fc9591c9d78430de2d84ae3f..e5669bd3233a1ac6ed2396511fdfbc7c1775bd74 100644 (file)
@@ -370,9 +370,6 @@ static void line6_toneport_disconnect(struct usb_interface *interface)
        struct usb_line6_toneport *toneport;
        u16 idProduct;
 
-       if (interface == NULL)
-               return;
-
        toneport = usb_get_intfdata(interface);
        del_timer_sync(&toneport->timer);
        idProduct = le16_to_cpu(toneport->line6.usbdev->descriptor.idProduct);
@@ -393,9 +390,6 @@ static int toneport_init(struct usb_interface *interface,
        int err;
        struct usb_line6_toneport *toneport =  (struct usb_line6_toneport *) line6;
 
-       if ((interface == NULL) || (toneport == NULL))
-               return -ENODEV;
-
        line6->disconnect = line6_toneport_disconnect;
 
        /* initialize PCM subsystem: */
index 99a58cbfd2da2b4047595d8d1c4e763165a3ba7f..cd3adeffde029fa00960884fddd61a5547694560 100644 (file)
@@ -214,12 +214,7 @@ static void line6_variax_disconnect(struct usb_interface *interface)
 {
        struct usb_line6_variax *variax;
 
-       if (!interface)
-               return;
-
        variax = usb_get_intfdata(interface);
-       if (!variax)
-               return;
 
        del_timer(&variax->startup_timer1);
        del_timer(&variax->startup_timer2);
@@ -244,9 +239,6 @@ static int variax_init(struct usb_interface *interface,
        init_timer(&variax->startup_timer2);
        INIT_WORK(&variax->startup_work, variax_startup6);
 
-       if ((interface == NULL) || (variax == NULL))
-               return -ENODEV;
-
        /* initialize USB buffers: */
        variax->buffer_activate = kmemdup(variax_activate,
                                          sizeof(variax_activate), GFP_KERNEL);