{
        int err;
 
+       /* Sanity check the profile handler */
+       if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) ||
+           !pprof->profile_set || !pprof->profile_get) {
+               pr_err("platform_profile: handler is invalid\n");
+               return -EINVAL;
+       }
+
        mutex_lock(&profile_lock);
        /* We can only have one active profile */
        if (cur_profile) {
                return -EEXIST;
        }
 
-       /* Sanity check the profile handler field are set */
-       if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) ||
-               !pprof->profile_set || !pprof->profile_get) {
-               mutex_unlock(&profile_lock);
-               return -EINVAL;
-       }
-
        err = sysfs_create_group(acpi_kobj, &platform_profile_group);
        if (err) {
                mutex_unlock(&profile_lock);