Commit 0320a278 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

uio: add missing error codes

My static checker complains that "ret" could be uninitialized at the
end, which is true but it's more likely that it would be set to zero.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2fad6224
...@@ -271,12 +271,16 @@ static int uio_dev_add_attributes(struct uio_device *idev) ...@@ -271,12 +271,16 @@ static int uio_dev_add_attributes(struct uio_device *idev)
map_found = 1; map_found = 1;
idev->map_dir = kobject_create_and_add("maps", idev->map_dir = kobject_create_and_add("maps",
&idev->dev->kobj); &idev->dev->kobj);
if (!idev->map_dir) if (!idev->map_dir) {
ret = -ENOMEM;
goto err_map; goto err_map;
} }
}
map = kzalloc(sizeof(*map), GFP_KERNEL); map = kzalloc(sizeof(*map), GFP_KERNEL);
if (!map) if (!map) {
ret = -ENOMEM;
goto err_map_kobj; goto err_map_kobj;
}
kobject_init(&map->kobj, &map_attr_type); kobject_init(&map->kobj, &map_attr_type);
map->mem = mem; map->mem = mem;
mem->map = map; mem->map = map;
...@@ -296,12 +300,16 @@ static int uio_dev_add_attributes(struct uio_device *idev) ...@@ -296,12 +300,16 @@ static int uio_dev_add_attributes(struct uio_device *idev)
portio_found = 1; portio_found = 1;
idev->portio_dir = kobject_create_and_add("portio", idev->portio_dir = kobject_create_and_add("portio",
&idev->dev->kobj); &idev->dev->kobj);
if (!idev->portio_dir) if (!idev->portio_dir) {
ret = -ENOMEM;
goto err_portio; goto err_portio;
} }
}
portio = kzalloc(sizeof(*portio), GFP_KERNEL); portio = kzalloc(sizeof(*portio), GFP_KERNEL);
if (!portio) if (!portio) {
ret = -ENOMEM;
goto err_portio_kobj; goto err_portio_kobj;
}
kobject_init(&portio->kobj, &portio_attr_type); kobject_init(&portio->kobj, &portio_attr_type);
portio->port = port; portio->port = port;
port->portio = portio; port->portio = portio;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment