Hi
Yes i did :-)
Here you can see code snippet of the dtb that triggered the NULL pointer
dereference:
sc16is750@1 {
compatible = "sc16is750";
spi-max-frequency = <2000000>;
reg = <1>;
clocks = <&clk14m>;
interrupt-parent = <&gpio7>;
interrupts = <5 2>;
}
And what my dtb should have looked like:
sc16is750@1 {
compatible = "nxp,sc16is750";
spi-max-frequency = <2000000>;
reg = <1>;
clocks = <&clk14m>;
interrupt-parent = <&gpio7>;
interrupts = <5 2>;
}
Br
Sean
On 2015-10-04 22:23, Uwe Kleine-König wrote:
On Mon, Aug 31, 2015 at 12:01:27PM +0200, Sean Nyekjaer wrote:
If a wrong compatible flag in specified, the of_match_device
returning null.
Implemented check and if NULL then returning -ENODEV.
Signed-off-by: Sean Nyekjaer <sean.nyekjaer@xxxxxxxxx>
---
drivers/tty/serial/sc16is7xx.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 72ffd0d..2fce9fb 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1320,6 +1320,8 @@ static int sc16is7xx_spi_probe(struct spi_device *spi)
if (spi->dev.of_node) {
const struct of_device_id *of_id =
of_match_device(sc16is7xx_dt_ids, &spi->dev);
+ if (!of_id)
+ return -ENODEV;
Did you see a problem here? I wonder if this can ever trigger. In the
commit log you wrote "If a wrong compatible flag in specified, ...", but
then the probe function isn't called at all, is it?
devtype = (struct sc16is7xx_devtype *)of_id->data;
} else {
Maybe the better fix is to remove the same if in the i2c probe routine?
Best regards
Uwe
--
Sean Nyekjær, Prevas A/S
Software developer
Hedeager 1, DK-8200 Aarhus N
Phone +45 87438070
Mobile +45 51925393
sean.nyekjaer@xxxxxxxxx
www.prevas.dk
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html