On 12/21/2018 02:46 AM, Dmitry Torokhov wrote: > Hi Marek, > > On Thu, Dec 20, 2018 at 09:42:59PM +0100, Marek Vasut wrote: >> Convert the driver to dev-managed allocations. >> >> Signed-off-by: Marek Vasut <marex@xxxxxxx> >> Cc: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> >> Cc: Henrik Rydberg <rydberg@xxxxxxxxxxx> >> Cc: Olivier Sobrie <olivier@xxxxxxxxx> >> Cc: Philipp Puschmann <pp@xxxxxxxxx> >> To: linux-input@xxxxxxxxxxxxxxx >> --- >> V2: No change >> --- >> drivers/input/touchscreen/ili210x.c | 13 ++++--------- >> 1 file changed, 4 insertions(+), 9 deletions(-) >> >> diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c >> index 11007bf8113c..322241472b9f 100644 >> --- a/drivers/input/touchscreen/ili210x.c >> +++ b/drivers/input/touchscreen/ili210x.c >> @@ -206,12 +206,10 @@ static int ili210x_i2c_probe(struct i2c_client *client, >> xmax = panel.finger_max.x_low | (panel.finger_max.x_high << 8); >> ymax = panel.finger_max.y_low | (panel.finger_max.y_high << 8); >> >> - priv = kzalloc(sizeof(*priv), GFP_KERNEL); >> - input = input_allocate_device(); >> - if (!priv || !input) { >> - error = -ENOMEM; >> - goto err_free_mem; >> - } >> + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); >> + input = devm_input_allocate_device(dev); >> + if (!priv || !input) > > With devm prefer allocation and test go together: > > priv = devm_kzalloc(...); > if (!priv) > return -ENOMEM; > > input = devm_input_allocate_device(dev); > if (!input) > return -ENOMEM; > > >> + return -ENOMEM; >> >> priv->client = client; >> priv->input = input; >> @@ -273,8 +271,6 @@ static int ili210x_i2c_probe(struct i2c_client *client, >> err_free_irq: >> free_irq(client->irq, priv); >> err_free_mem: >> - input_free_device(input); >> - kfree(priv); >> return error; >> } >> >> @@ -286,7 +282,6 @@ static int ili210x_i2c_remove(struct i2c_client *client) >> free_irq(priv->client->irq, priv); >> cancel_delayed_work_sync(&priv->dwork); >> input_unregister_device(priv->input); > > Not needed, will be handled by devm. All fixed in V3 -- Best regards, Marek Vasut