ALSA: snd-usb-caiaq: fix smatch warnings
authorDaniel Mack <zonque@gmail.com>
Mon, 4 Mar 2013 11:50:05 +0000 (12:50 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 7 Mar 2013 08:24:12 +0000 (09:24 +0100)
Fix three smatch warnings recently introduced:

sound/usb/caiaq/device.c:166 usb_ep1_command_reply_dispatch() warn:
  variable dereferenced before check 'cdev' (see line 163)
sound/usb/caiaq/device.c:517 snd_disconnect() warn: variable
  dereferenced before check 'card' (see line 514)
sound/usb/caiaq/input.c:510 snd_usb_caiaq_ep4_reply_dispatch() warn:
  variable dereferenced before check 'cdev' (see line 506)

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/caiaq/device.c
sound/usb/caiaq/input.c

index d898f737c07e8ca83f1823631e9f8671c8231864..48b63ccc78c7e9da35aa4e1ba81d3a8e16672c20 100644 (file)
@@ -159,8 +159,8 @@ static struct usb_device_id snd_usb_id_table[] = {
 static void usb_ep1_command_reply_dispatch (struct urb* urb)
 {
        int ret;
+       struct device *dev = &urb->dev->dev;
        struct snd_usb_caiaqdev *cdev = urb->context;
-       struct device *dev = caiaqdev_to_dev(cdev);
        unsigned char *buf = urb->transfer_buffer;
 
        if (urb->status || !cdev) {
@@ -511,13 +511,13 @@ static int snd_probe(struct usb_interface *intf,
 static void snd_disconnect(struct usb_interface *intf)
 {
        struct snd_card *card = usb_get_intfdata(intf);
-       struct snd_usb_caiaqdev *cdev = caiaqdev(card);
-       struct device *dev;
+       struct device *dev = intf->usb_dev;
+       struct snd_usb_caiaqdev *cdev;
 
        if (!card)
                return;
 
-       dev = caiaqdev_to_dev(cdev);
+       cdev = caiaqdev(card);
        dev_dbg(dev, "%s(%p)\n", __func__, intf);
 
        snd_card_disconnect(card);
index fe8f4b4fd369eeab78ddafc1a18c9a867e7fc15c..efc70ae915c5eff215e56f89d96e4bb32f7c09c1 100644 (file)
@@ -503,8 +503,8 @@ static void snd_usb_caiaq_maschine_dispatch(struct snd_usb_caiaqdev *cdev,
 static void snd_usb_caiaq_ep4_reply_dispatch(struct urb *urb)
 {
        struct snd_usb_caiaqdev *cdev = urb->context;
-       struct device *dev = caiaqdev_to_dev(cdev);
        unsigned char *buf = urb->transfer_buffer;
+       struct device *dev = &urb->dev->dev;
        int ret;
 
        if (urb->status || !cdev || urb != cdev->ep4_in_urb)