[Cbe-oss-dev] [PATCH] cell: cbe_cpufreq cleanup and crash fix

Akinobu Mita mita at fixstars.com
Fri Apr 27 15:22:06 EST 2007


On Thu, Apr 26, 2007 at 06:07:54PM -0500, Olof Johansson wrote:
> @@ -303,6 +303,9 @@ static int __init cbe_cpufreq_init(void)
>  {
>  	struct device_node *np;
>  
> +	if (!machine_is(cell))
> +		return 0;
> +

Please return -ENODEV to prevent loading module.

Otherwise it will cause crash when unloading the module
because of cpufreq_unregister_driver() with unregistered driver.

> @@ -315,7 +318,7 @@ static int __init cbe_cpufreq_init(void)
>  
>  static void __exit cbe_cpufreq_exit(void)
>  {
> -	if(pmi_dev)
> +	if (pmi_dev)
>  		pmi_unregister_handler(pmi_dev, &cbe_pmi_handler);
>  
>  	cpufreq_unregister_driver(&cbe_cpufreq_driver);



More information about the Linuxppc-dev mailing list