From ea365922f9eb2fb6fc0486f521748f19bfd5c502 Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz Date: Mon, 13 Jan 2014 16:49:35 +0100 Subject: [PATCH] usb: gadget: FunctionFS: dereference ffs_dev conditionally ffs_dev->ffs_release_dev_callback should be accessed only if ffs_dev is not NULL. Acked-by: Michal Nazarewicz Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Felipe Balbi --- drivers/usb/gadget/f_fs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 306a2b52125c..78333f033e90 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c @@ -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(); } -- 2.20.1