if (retval)
                return retval;
 
+       if (profile < 1 || profile > 5)
+               return -EINVAL;
+
        temp_buf.command = ARVO_COMMAND_ACTUAL_PROFILE;
        temp_buf.actual_profile = profile;
 
        if (size != 3)
                return 0;
 
-       if (arvo->roccat_claimed)
+       if (arvo && arvo->roccat_claimed)
                arvo_report_to_chrdev(arvo, data);
 
        return 0;
 
        if (size != sizeof(struct kone_mouse_event))
                return 0;
 
+       if (kone == NULL)
+               return 0;
+
        /*
         * Firmware 1.38 introduced new behaviour for tilt and special buttons.
         * Pressed button is reported in each movement event.
 
        if (retval)
                return retval;
 
+       if (profile > 4)
+               return -EINVAL;
+
        mutex_lock(&koneplus->koneplus_lock);
 
        retval = koneplus_set_actual_profile(usb_dev, profile);
                return retval;
        }
 
-       koneplus->actual_profile = profile;
+       koneplus_profile_activated(koneplus, profile);
 
        roccat_report.type = KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE;
        roccat_report.data1 = profile + 1;
                        != USB_INTERFACE_PROTOCOL_MOUSE)
                return 0;
 
+       if (koneplus == NULL)
+               return 0;
+
        koneplus_keep_values_up_to_date(koneplus, data);
 
        if (koneplus->roccat_claimed)
 
 
        mutex_lock(&kovaplus->kovaplus_lock);
        retval = kovaplus_set_actual_profile(usb_dev, profile);
-       kovaplus->actual_profile = profile;
+       kovaplus_profile_activated(kovaplus, profile);
        mutex_unlock(&kovaplus->kovaplus_lock);
        if (retval)
                return retval;
                        != USB_INTERFACE_PROTOCOL_MOUSE)
                return 0;
 
+       if (kovaplus == NULL)
+               return 0;
+
        kovaplus_keep_values_up_to_date(kovaplus, data);
 
        if (kovaplus->roccat_claimed)
 
                        != USB_INTERFACE_PROTOCOL_MOUSE)
                return 0;
 
+       if (pyra == NULL)
+               return 0;
+
        pyra_keep_values_up_to_date(pyra, data);
 
        if (pyra->roccat_claimed)