[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1521650920-11578-1-git-send-email-pierre-yves.mordret@st.com>
Date: Wed, 21 Mar 2018 17:48:40 +0100
From: Pierre-Yves MORDRET <pierre-yves.mordret@...com>
To: Wolfram Sang <wsa@...-dreams.de>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...com>,
<linux-i2c@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
CC: Pierre-Yves MORDRET <pierre-yves.mordret@...com>
Subject: [PATCH v2] i2c: i2c-stm32f7: fix no check on returned setup
Before assigning returned setup structure check if not null
Fixes: 463a9215f3ca7600b5ff ("i2c: stm32f7: fix setup structure")
Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@...com>
---
Version history:
v1:
* Initial
v2:
* fill "ret" with error statement before go to "clk_free"
---
---
drivers/i2c/busses/i2c-stm32f7.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index b445b3b..f273e28 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -888,6 +888,11 @@ 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");
+ ret = -ENODEV;
+ goto clk_free;
+ }
i2c_dev->setup = *setup;
ret = device_property_read_u32(i2c_dev->dev, "i2c-scl-rising-time-ns",
--
2.7.4
Powered by blists - more mailing lists