Compare commits

1 Commits
bka ... vic

Author SHA1 Message Date
188e572822 input: cyttsp_button: fix kernfs_path() usage
In the msm8996 kernel, the kernfs_path() function has an updated signature
that returns int instead of char *, which breaks compilation of the
cyttsp_button driver. This patch updates the code to properly handle the
new signature by passing a buffer and checking the return value.

Signed-off-by: Onelots <onelots@onelots.fr>
2025-05-06 03:02:53 +02:00

View File

@@ -1183,36 +1183,47 @@ static const struct attribute_group cyttsp_attr_group = {
static int cyttsp_proc_init(struct kernfs_node *sysfs_node_parent)
{
int ret = 0;
char *buf, *path = NULL;
char *reversed_keys_sysfs_node;
struct proc_dir_entry *proc_entry_buttons = NULL;
struct proc_dir_entry *proc_symlink_tmp = NULL;
int ret = 0;
char *buf, *path = NULL;
char *reversed_keys_sysfs_node;
struct proc_dir_entry *proc_entry_buttons = NULL;
struct proc_dir_entry *proc_symlink_tmp = NULL;
buf = kzalloc(PATH_MAX, GFP_KERNEL);
if (buf)
path = kernfs_path(sysfs_node_parent, buf, PATH_MAX);
buf = kzalloc(PATH_MAX, GFP_KERNEL);
if (buf) {
ret = kernfs_path(sysfs_node_parent, buf, PATH_MAX);
if (ret >= 0)
path = buf;
else {
pr_err("%s: kernfs_path() failed\n", __func__);
kfree(buf);
return ret;
}
} else {
pr_err("%s: Failed to allocate buffer for path\n", __func__);
return -ENOMEM;
}
proc_entry_buttons = proc_mkdir("buttons", NULL);
if (proc_entry_buttons == NULL) {
ret = -ENOMEM;
pr_err("%s: Couldn't create buttons\n", __func__);
}
proc_entry_buttons = proc_mkdir("buttons", NULL);
if (proc_entry_buttons == NULL) {
ret = -ENOMEM;
pr_err("%s: Couldn't create buttons\n", __func__);
}
reversed_keys_sysfs_node = kzalloc(PATH_MAX, GFP_KERNEL);
if (reversed_keys_sysfs_node) {
snprintf(reversed_keys_sysfs_node, PATH_MAX, "/sys%s/%s", path, "reversed_keys");
}
proc_symlink_tmp = proc_symlink("reversed_keys_enable",
proc_entry_buttons, reversed_keys_sysfs_node);
if (proc_symlink_tmp == NULL) {
ret = -ENOMEM;
pr_err("%s: Couldn't create reversed_keys_enable symlink\n", __func__);
}
reversed_keys_sysfs_node = kzalloc(PATH_MAX, GFP_KERNEL);
if (reversed_keys_sysfs_node)
sprintf(reversed_keys_sysfs_node, "/sys%s/%s", path, "reversed_keys");
proc_symlink_tmp = proc_symlink("reversed_keys_enable",
proc_entry_buttons, reversed_keys_sysfs_node);
if (proc_symlink_tmp == NULL) {
ret = -ENOMEM;
pr_err("%s: Couldn't create reversed_keys_enable symlink\n", __func__);
}
kfree(buf);
kfree(reversed_keys_sysfs_node);
kfree(buf);
kfree(reversed_keys_sysfs_node);
return ret;
return ret;
}
static int cyttsp_button_pinctrl_init(struct cyttsp_button_data *data)