]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
i2c: i2c-stm32f7: fix no check on returned setup
authorPierre-Yves MORDRET <pierre-yves.mordret@st.com>
Wed, 21 Mar 2018 16:48:40 +0000 (17:48 +0100)
committerWolfram Sang <wsa@the-dreams.de>
Sat, 24 Mar 2018 12:37:41 +0000 (13:37 +0100)
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
drivers/i2c/busses/i2c-stm32f7.c

index b445b3bb0bb11fe262363042a2eb56e458f6ffc2..f273e28c39db2ec5f667a6b4fd27d1377f8e31a4 100644 (file)
@@ -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",