Russell King wrote: > >I still don't like the needless duplication. How about doing it this >way (see the attached patch.) > >Note: I also intend to move MMC over to using an IDR for the host >numbers, which is why we need to setup the name at registration >time, not allocation time. > > >
This patch should cover the edge case of allocating but not registering a host. Rgds Pierre
diff -uNp linux-2.6.13-rc6/drivers/mmc.orig/mmc.c linux-2.6.13-rc6/drivers/mmc/mmc.c --- linux-2.6.13-rc6/drivers/mmc.orig/mmc.c 2005-08-08 13:29:53.000000000 +0200 +++ linux-2.6.13-rc6/drivers/mmc/mmc.c 2005-08-08 13:36:08.000000000 +0200 @@ -874,7 +874,11 @@ EXPORT_SYMBOL(mmc_remove_host); void mmc_free_host(struct mmc_host *host) { flush_scheduled_work(); - mmc_free_host_sysfs(host); + + if (host->class_dev.class != NULL) + mmc_free_host_sysfs(host); + else + kfree(host); } EXPORT_SYMBOL(mmc_free_host);