diff options
author | Pierre-Yves MORDRET <pierre-yves.mordret@st.com> | 2018-03-21 17:48:40 +0100 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2018-03-24 13:37:41 +0100 |
commit | 771b7bf05339081019d22452ebcab6929372e13e (patch) | |
tree | 256eef8aa766a67f969c36349520ba73cfd6160b /drivers/i2c/busses/i2c-stm32f7.c | |
parent | Linux 4.16-rc6 (diff) | |
download | linux-771b7bf05339081019d22452ebcab6929372e13e.tar.xz linux-771b7bf05339081019d22452ebcab6929372e13e.zip |
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@st.com>
Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
Diffstat (limited to 'drivers/i2c/busses/i2c-stm32f7.c')
-rw-r--r-- | drivers/i2c/busses/i2c-stm32f7.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c index b445b3bb0bb1..f273e28c39db 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", |