Fix error handling for input device
input_free_device only needs to be called if input_register_device
failed, not in all error cases. Per devm_input_allocate_device
documentation, managed devices do not need to be explicitly unregistered
or freed, so do not add any other cleanup for the device.
Fixes: c169971892 ("Address feedback from upstream")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
parent
b82bcba7d9
commit
b49caa557e
|
|
@ -732,8 +732,10 @@ static int system76_add(struct acpi_device *acpi_dev)
|
||||||
input_set_capability(data->input, EV_KEY, KEY_SCREENLOCK);
|
input_set_capability(data->input, EV_KEY, KEY_SCREENLOCK);
|
||||||
|
|
||||||
err = input_register_device(data->input);
|
err = input_register_device(data->input);
|
||||||
if (err)
|
if (err) {
|
||||||
goto error;
|
input_free_device(data->input);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
err = system76_get_object(data, "NFAN", &data->nfan);
|
err = system76_get_object(data, "NFAN", &data->nfan);
|
||||||
if (err)
|
if (err)
|
||||||
|
|
@ -756,7 +758,6 @@ static int system76_add(struct acpi_device *acpi_dev)
|
||||||
error:
|
error:
|
||||||
kfree(data->ntmp);
|
kfree(data->ntmp);
|
||||||
kfree(data->nfan);
|
kfree(data->nfan);
|
||||||
input_free_device(data->input);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue