summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorKunwu Chan <chentao@kylinos.cn>2024-01-18 22:37:59 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2024-01-19 02:21:34 +0300
commitbc4996184d56cfaf56d3811ac2680c8a0e2af56e (patch)
tree8925160ed86a17753278df4c40df719af8fc45b1 /drivers/input
parentf0eb58dd08770a2e24bfc41db5ee3ff7c3a684ee (diff)
downloadlinux-bc4996184d56cfaf56d3811ac2680c8a0e2af56e.tar.xz
Input: synaptics-rmi4 - fail probing if memory allocation for "phys" fails
While input core can work with input->phys set to NULL userspace might depend on it, so better fail probing if allocation fails. The system must be in a pretty bad shape for it to happen anyway. Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Link: https://lore.kernel.org/r/20240117073124.143636-1-chentao@kylinos.cn Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/rmi4/rmi_driver.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 258d5fe3d395..aa32371f04af 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -1196,7 +1196,11 @@ static int rmi_driver_probe(struct device *dev)
}
rmi_driver_set_input_params(rmi_dev, data->input);
data->input->phys = devm_kasprintf(dev, GFP_KERNEL,
- "%s/input0", dev_name(dev));
+ "%s/input0", dev_name(dev));
+ if (!data->input->phys) {
+ retval = -ENOMEM;
+ goto err;
+ }
}
retval = rmi_init_functions(data);