On Sat, 2009-11-21 at 12:31 +0000, Matt Fleming wrote: > Fancy giving this patch a try? I think it's just a case of removing too > many funcs in the error path. Thanks! Yes, I agree that looks like the culprit. I applied something very similar to your patch and the crash went away. The one additional change I made is in sdio_bus.c : void sdio_remove_func(struct sdio_func *func) { - if (sdio_func_present(func)) - device_del(&func->dev); + if (!sdio_func_present(func)) + return; + device_del(&func->dev); put_device(&func->dev); } I think this is necessary because the error path will go mmc_sdio_remove --> sdio_remove_func Hence sdio_remove_func() will be called when sdio_add_func() was never called beforehand, so there is no func->dev reference to drop. Do you agree? I'm not certain about this one. Thanks! Daniel > diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c > index cdb845b..cdec9c8 100644 > --- a/drivers/mmc/core/sdio.c > +++ b/drivers/mmc/core/sdio.c > @@ -516,7 +516,8 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr) > * The number of functions on the card is encoded inside > * the ocr. > */ > - card->sdio_funcs = funcs = (ocr & 0x70000000) >> 28; > + funcs = (ocr & 0x70000000) >> 28; > + card->sdio_funcs = 0; > > /* > * If needed, disconnect card detection pull-up resistor. > @@ -528,7 +529,7 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr) > /* > * Initialize (but don't add) all present functions. > */ > - for (i = 0;i < funcs;i++) { > + for (i = 0;i < funcs;i++,card->sdio_funcs++) { > err = sdio_init_func(host->card, i + 1); > if (err) > goto remove; -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html