Commit c8814df3 authored by Jesper Juhl's avatar Jesper Juhl Committed by Mauro Carvalho Chehab

[media] [Resend] viacam: Don't explode if pci_find_bus() returns NULL

In the unlikely case that pci_find_bus() should return NULL
viacam_serial_is_enabled() is going to dereference a NULL pointer and
blow up. Better safe than sorry, so be defensive and check the
Signed-off-by: default avatarJesper Juhl <>
Acked-by: default avatarJonathan Corbet <>
Signed-off-by: default avatarMauro Carvalho Chehab <>
parent 6a02a330
......@@ -1332,6 +1332,8 @@ static __devinit bool viacam_serial_is_enabled(void)
struct pci_bus *pbus = pci_find_bus(0, 0);
u8 cbyte;
if (!pbus)
return false;
pci_bus_read_config_byte(pbus, VIACAM_SERIAL_DEVFN,
if ((cbyte & VIACAM_SERIAL_BIT) == 0)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment