public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC 1/1] Driver Core: don't oops with unregistered driver in driver_find_device()
@ 2012-05-10  7:35 Hiroshi DOYU
       [not found] ` <1336635302-29260-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Hiroshi DOYU @ 2012-05-10  7:35 UTC (permalink / raw)
  To: hdoyu-DDmLM1+adcrQT0dZR+AlfA
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Greg Kroah-Hartman, linux-kernel-u79uwXL29TY76Z2rM5mHXA

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 <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-05-11  8:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-10  7:35 [RFC 1/1] Driver Core: don't oops with unregistered driver in driver_find_device() Hiroshi DOYU
     [not found] ` <1336635302-29260-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-05-10 14:11   ` Greg Kroah-Hartman
     [not found]     ` <20120510141130.GA20373-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-05-10 15:59       ` Stephen Warren
     [not found]         ` <4FABE5D3.9040706-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-10 18:16           ` Greg Kroah-Hartman
     [not found]             ` <20120510181611.GA16908-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-05-10 20:00               ` Stephen Warren
     [not found]                 ` <4FAC1E70.8030907-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-10 22:28                   ` Greg Kroah-Hartman
     [not found]                     ` <20120510222830.GA23084-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-05-10 22:34                       ` Stephen Warren
     [not found]                         ` <4FAC4280.4000100-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-10 22:45                           ` Greg Kroah-Hartman
2012-05-11  8:03                           ` Hiroshi Doyu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox