Re: [PATCH] base/platform: fix panic when probe function is NULL
From: Uwe Kleine-König
Date: Tue Dec 01 2015 - 08:24:43 EST
Hello Martin,
On Tue, Dec 01, 2015 at 11:41:53AM +0100, Wilck, Martin wrote:
> > This sounds like a separate issue though. Looking at init_tis there is:
> >
> > rc = platform_driver_register(&tis_drv);
> > if (rc < 0)
> > return rc;
> > pdev = platform_device_register_simple("tpm_tis", -1, NULL, 0);
> > if (IS_ERR(pdev)) {
> > rc = PTR_ERR(pdev);
> > goto err_dev;
> > }
> > rc = tpm_tis_init(&pdev->dev, &tis_default_info, NULL);
> >
> > tpm_tis_init calls tpmm_chip_alloc which barfs when pdev (i.e. the return value
> > of platform_device_register_simple above) isn't bound. It is not allowed
> > to assume that the device is bound after the above function calls.
>
> Can you please explain again why you think that assumption is invalid?
You can unbind a device from a driver via sysfs, you can also prevent
binding somehow I think, probing can fail for different reasons, probing
might wait for userspace interaction to load firmware which wasn't
scheduled yet. I'm sure there are still more things that break the
assumption.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/