media: pci: smipcie: smipcie-main: convert to use i2c_new_client_device()
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Mon, 16 Dec 2019 15:51:35 +0000 (16:51 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 9 Jan 2020 15:02:14 +0000 (16:02 +0100)
Use the newer API returning an ERRPTR and use the new helper to bail
out.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/pci/smipcie/smipcie-main.c

index 1fb7846..9ca0fc3 100644 (file)
@@ -484,8 +484,8 @@ static struct i2c_client *smi_add_i2c_client(struct i2c_adapter *adapter,
        struct i2c_client *client;
 
        request_module(info->type);
-       client = i2c_new_device(adapter, info);
-       if (client == NULL || client->dev.driver == NULL)
+       client = i2c_new_client_device(adapter, info);
+       if (!i2c_client_has_driver(client))
                goto err_add_i2c_client;
 
        if (!try_module_get(client->dev.driver->owner)) {