Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756887Ab2EJHhU (ORCPT ); Thu, 10 May 2012 03:37:20 -0400 Received: from hqemgate03.nvidia.com ([216.228.121.140]:17305 "EHLO hqemgate03.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756153Ab2EJHhS (ORCPT ); Thu, 10 May 2012 03:37:18 -0400 X-PGP-Universal: processed; by hqnvupgp06.nvidia.com on Thu, 10 May 2012 00:35:08 -0700 From: Hiroshi DOYU To: CC: , , Greg Kroah-Hartman , Subject: [RFC 1/1] Driver Core: don't oops with unregistered driver in driver_find_device() Date: Thu, 10 May 2012 10:35:02 +0300 Message-ID: <1336635302-29260-1-git-send-email-hdoyu@nvidia.com> X-Mailer: git-send-email 1.7.5.4 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1103 Lines: 35 driver_find_device() can be called with an unregistered driver. Need to check driver_private to see if it's populated or not, especially under deferrable probe. Signed-off-by: Hiroshi DOYU --- In [PATCHv5 2/3] ARM: tegra: Add SMMU enabler in AHB: http://article.gmane.org/gmane.linux.ports.tegra/4658 "tegra_ahb_driver" may not be populated when it's called. --- drivers/base/driver.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 3ec3896..207c27d 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c @@ -80,7 +80,7 @@ struct device *driver_find_device(struct device_driver *drv, struct klist_iter i; struct device *dev; - if (!drv) + if (!drv || !drv->p) return NULL; klist_iter_init_node(&drv->p->klist_devices, &i, -- 1.7.5.4 -- 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/