]> git.baikalelectronics.ru Git - kernel.git/commit
spi: orion: fix potential NULL pointer de-reference
authorGreg Ungerer <gerg@uclinux.org>
Tue, 21 Oct 2014 05:57:48 +0000 (15:57 +1000)
committerMark Brown <broonie@kernel.org>
Wed, 22 Oct 2014 10:05:54 +0000 (11:05 +0100)
commitf1e6ec02f66bd7674eefe903a94e3389e751d1d6
treebf32e9630ecff25d1f110fdcfe36f4ea63396f6c
parent794664fc5e82534aa444b079f807e339c4d8d9b5
spi: orion: fix potential NULL pointer de-reference

It's possible that the call to of_match_device() (introduced in commit
f0ea0082 ["spi: orion: support armada extended baud rates"]) may return
a NULL if there is no match in the device tree (or perhaps no device tree
at all). Check the return pointer and set the local device data to the
lowest common denominator orion device data if it is NULL.

Reported-by: Karl Beldan <karl.beldan@gmail.com>
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-orion.c