staging: olpc_dcon: Do not call platform_device_unregister() in dcon_probe()
authorJing Xiangfeng <jingxiangfeng@huawei.com>
Fri, 20 Nov 2020 07:49:32 +0000 (15:49 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Dec 2020 18:45:13 +0000 (19:45 +0100)
In dcon_probe(), when platform_device_add() failes to add the device,
it jumps to call platform_device_unregister() to remove the device,
which is unnecessary. So use platform_device_put() instead.

Fixes: 53c43c5ca133 ("Revert "Staging: olpc_dcon: Remove obsolete driver"")
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Link: https://lore.kernel.org/r/20201120074932.31871-1-jingxiangfeng@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/olpc_dcon/olpc_dcon.c

index a0d6d90f4cc8bc4787a852cc57e8a00090be3a35..e7281212db5b049162ebfa0d66c5c115f8dc6a0e 100644 (file)
@@ -659,8 +659,9 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
  ecreate:
        for (j = 0; j < i; j++)
                device_remove_file(&dcon_device->dev, &dcon_device_files[j]);
+       platform_device_del(dcon_device);
  edev:
-       platform_device_unregister(dcon_device);
+       platform_device_put(dcon_device);
        dcon_device = NULL;
  eirq:
        free_irq(DCON_IRQ, dcon);