usb: gadget: FunctionFS: dereference ffs_dev conditionally
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Mon, 13 Jan 2014 15:49:35 +0000 (16:49 +0100)
committerFelipe Balbi <balbi@ti.com>
Tue, 18 Feb 2014 16:52:55 +0000 (10:52 -0600)
ffs_dev->ffs_release_dev_callback should be accessed only if ffs_dev
is not NULL.

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/f_fs.c

index 306a2b52125c8e7ee2eba91bcf1156e689ae133e..78333f033e90f811cb469b0ab2fa9ba4093cf5a8 100644 (file)
@@ -2590,11 +2590,12 @@ static void ffs_release_dev(struct ffs_data *ffs_data)
        ffs_dev_lock();
 
        ffs_dev = ffs_data->private_data;
-       if (ffs_dev)
+       if (ffs_dev) {
                ffs_dev->mounted = false;
-       
-       if (ffs_dev->ffs_release_dev_callback)
-               ffs_dev->ffs_release_dev_callback(ffs_dev);
+
+               if (ffs_dev->ffs_release_dev_callback)
+                       ffs_dev->ffs_release_dev_callback(ffs_dev);
+       }
 
        ffs_dev_unlock();
 }