hidpp20: fix dereference before null check

Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2017-04-27 11:28:52 +10:00
committed by bentiss
parent 5934816b11
commit 5c0dbe4d5c

View File

@@ -909,12 +909,15 @@ hidpp20_log(void *userdata, enum hidpp_log_priority priority, const char *format
static void
hidpp20drv_remove(struct ratbag_device *device)
{
struct hidpp20drv_data *drv_data = ratbag_get_drv_data(device);
struct hidpp20_device *dev = drv_data->dev;
struct hidpp20drv_data *drv_data;
struct hidpp20_device *dev;
if (!device)
return;
drv_data = ratbag_get_drv_data(device);
dev = drv_data->dev;
ratbag_close_hidraw(device);
if (drv_data->profiles)