Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755219AbbLANYj (ORCPT ); Tue, 1 Dec 2015 08:24:39 -0500 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:35120 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753810AbbLANYi (ORCPT ); Tue, 1 Dec 2015 08:24:38 -0500 Date: Tue, 1 Dec 2015 14:24:36 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: "Wilck, Martin" Cc: "linux-kernel@vger.kernel.org" , "tpmdd-devel@lists.sourceforge.net" Subject: Re: [PATCH] base/platform: fix panic when probe function is NULL Message-ID: <20151201132436.GC5072@pengutronix.de> References: <1448564494-23218-1-git-send-email-martin.wilck@ts.fujitsu.com> <20151127101125.GS19888@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1553 Lines: 38 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/