Commit "i2c: core: make it possible to match a pure device tree driver"
changed semantics of the i2c probing for device tree devices.
Device tree probed devices now get a NULL i2c_device_id pointer.
This caused kernel panics due to NULL dereference.
Tested-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
        int chip_id;
 
        pdata = client->dev.platform_data;
-       chip_id = id->driver_data;
 
        if (client->dev.of_node) {
                const struct of_device_id *match;
                chip_id = (int)match->data;
                if (!pdata)
                        pdata = of_get_tps62360_platform_data(&client->dev);
+       } else if (id) {
+               chip_id = id->driver_data;
+       } else {
+               dev_err(&client->dev, "No device tree match or id table match found\n");
+               return -ENODEV;
        }
 
        if (!pdata) {
                return -ENODEV;
        }
 
-       tps->desc.name = id->name;
+       tps->desc.name = client->name;
        tps->desc.id = 0;
        tps->desc.ops = &tps62360_dcdc_ops;
        tps->desc.type = REGULATOR_VOLTAGE;