diff options
author | Colin King <colin.king@canonical.com> | 2015-09-14 15:35:04 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2015-09-29 09:00:58 -0400 |
commit | 6a6120bc5ec9e54d3cc06e739c270b55b081abe5 (patch) | |
tree | 920798384dd3dad9f03bd9094595784b1dd1b907 | |
parent | 12a509336701132f521c8fc22a5910478ca98cb3 (diff) |
drivers/ps3: Fix ps3-vuart null dereference
On the unlikely event that drv is null, the current code will
perform a null pointer dereference with it when printing a dev_dbg
message. Instead, the BUG_ON check on drv should be performed
before we emit the dev_dbg message.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r-- | drivers/ps3/ps3-vuart.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/ps3/ps3-vuart.c b/drivers/ps3/ps3-vuart.c index d6db822bef84..632701a1d993 100644 --- a/drivers/ps3/ps3-vuart.c +++ b/drivers/ps3/ps3-vuart.c | |||
@@ -1000,12 +1000,11 @@ static int ps3_vuart_probe(struct ps3_system_bus_device *dev) | |||
1000 | dev_dbg(&dev->core, "%s:%d\n", __func__, __LINE__); | 1000 | dev_dbg(&dev->core, "%s:%d\n", __func__, __LINE__); |
1001 | 1001 | ||
1002 | drv = ps3_system_bus_dev_to_vuart_drv(dev); | 1002 | drv = ps3_system_bus_dev_to_vuart_drv(dev); |
1003 | BUG_ON(!drv); | ||
1003 | 1004 | ||
1004 | dev_dbg(&dev->core, "%s:%d: (%s)\n", __func__, __LINE__, | 1005 | dev_dbg(&dev->core, "%s:%d: (%s)\n", __func__, __LINE__, |
1005 | drv->core.core.name); | 1006 | drv->core.core.name); |
1006 | 1007 | ||
1007 | BUG_ON(!drv); | ||
1008 | |||
1009 | if (dev->port_number >= PORT_COUNT) { | 1008 | if (dev->port_number >= PORT_COUNT) { |
1010 | BUG(); | 1009 | BUG(); |
1011 | return -EINVAL; | 1010 | return -EINVAL; |