DORMANTno replies

[RESEND PATCH v1] i2c: i2c-stm32f7: fix no check on returned setup

From: Pierre-Yves MORDRET <hidden>
Date: 2018-02-27 09:48:20
Also in: linux-i2c, lkml
Subsystem: i2c subsystem, i2c subsystem host drivers, st stm32 i2c/smbus driver, the rest · Maintainers: Andi Shyti, Pierre-Yves MORDRET, Alain Volmat, Linus Torvalds

Before assigning returned setup structure check if not null

Fixes: 463a9215f3ca7600b5ff ("i2c: stm32f7: fix setup structure")
Signed-off-by: Pierre-Yves MORDRET <redacted>
---
  Version history:
     v1:
         * Initial
---
---
 drivers/i2c/busses/i2c-stm32f7.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index b445b3b..16c7d77 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -888,6 +888,10 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
 	}
 
 	setup = of_device_get_match_data(&pdev->dev);
+	if (!setup) {
+		dev_err(&pdev->dev, "Can't get device data\n");
+		goto clk_free;
+	}
 	i2c_dev->setup = *setup;
 
 	ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-rising-time-ns",
-- 
2.7.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help