staging: olpc_dcon: Do not call platform_device_unregister() in dcon_probe()

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: 53c43c5ca1 ("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>
This commit is contained in:
Jing Xiangfeng 2020-11-20 15:49:32 +08:00 committed by Greg Kroah-Hartman
parent 7fe5bbdd1f
commit 4996b46107
1 changed files with 2 additions and 1 deletions

View 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);