Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

[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
pointer.

Signed-off-by: default avatarJesper Juhl <jj@chaosbits.net>
Acked-by: default avatarJonathan Corbet <corbet@lwn.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 6a02a330
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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,
			VIACAM_SERIAL_CREG, &cbyte);
	if ((cbyte & VIACAM_SERIAL_BIT) == 0)