From 9cec4e6a94a6456bbb3deb14688c690217e4190c Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 13 Dec 2016 16:26:03 +0100 Subject: [PATCH] hotplug: fix uninitialized variable Commit e999ab7 (hotplug: Check chown return value) introduced a new variable "ret" which is not explicitely initialized, leading to the following compile error: hotplug.c:155:18: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (!g || ret < 0) ^ cc1: all warnings being treated as errors Explicitely initialize it to zero to avoid that problem. Signed-off-by: Jo-Philipp Wich --- plug/hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plug/hotplug.c b/plug/hotplug.c index 54a90cc..ae972f6 100644 --- a/plug/hotplug.c +++ b/plug/hotplug.c @@ -130,7 +130,7 @@ static void handle_makedev(struct blob_attr *msg, struct blob_attr *data) char *minor = hotplug_msg_find_var(msg, "MINOR"); char *major = hotplug_msg_find_var(msg, "MAJOR"); char *subsystem = hotplug_msg_find_var(msg, "SUBSYSTEM"); - int ret; + int ret = 0; blobmsg_parse_array(mkdev_policy, 3, tb, blobmsg_data(data), blobmsg_data_len(data)); if (tb[0] && tb[1] && minor && major && subsystem) { -- 2.11.0