Hi Jukka, you wrote: > +int > +cpufreq_register(struct cpufreq *cf) > +{ .... > + mutex_enter(&cpufreq_lock); > + > + if (cf_backend != NULL) { > + mutex_exit(&cpufreq_lock); > + return EALREADY; > + } > + > + mutex_exit(&cpufreq_lock); > + cf_backend = kmem_zalloc(sizeof(*cf), KM_SLEEP); ^ You probably need to assign to a temporary variable here
> + > + if (cf_backend == NULL) > + return ENOMEM; > + > + mutex_enter(&cpufreq_lock); and do cf_backend != NULL check one more time here before assigning a new value (from the temporary variable) to cf_backend. ... > +void > +cpufreq_deregister(void) > +{ > + > + mutex_enter(&cpufreq_lock); > + > + if (cf_backend == NULL) { > + mutex_exit(&cpufreq_lock); > + return; > + } > + > + mutex_exit(&cpufreq_lock); > + kmem_free(cf_backend, sizeof(*cf_backend)); > + cf_backend = NULL; And something similar here. > +} Alex