aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-04-01 07:04:23 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-05-01 17:11:12 -0400
commit0320a278b9ef80cfa44f74b7f9bb36781695f3ee (patch)
tree1f13df91e2af7f99ca55ef9cc0c9a7b7aceeefe4
parent2fad622483707825222d2c38acb368681c75bbaa (diff)
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: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/uio/uio.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index bcc1fc027311..fba021f5736a 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -271,12 +271,16 @@ static int uio_dev_add_attributes(struct uio_device *idev)
271 map_found = 1; 271 map_found = 1;
272 idev->map_dir = kobject_create_and_add("maps", 272 idev->map_dir = kobject_create_and_add("maps",
273 &idev->dev->kobj); 273 &idev->dev->kobj);
274 if (!idev->map_dir) 274 if (!idev->map_dir) {
275 ret = -ENOMEM;
275 goto err_map; 276 goto err_map;
277 }
276 } 278 }
277 map = kzalloc(sizeof(*map), GFP_KERNEL); 279 map = kzalloc(sizeof(*map), GFP_KERNEL);
278 if (!map) 280 if (!map) {
281 ret = -ENOMEM;
279 goto err_map_kobj; 282 goto err_map_kobj;
283 }
280 kobject_init(&map->kobj, &map_attr_type); 284 kobject_init(&map->kobj, &map_attr_type);
281 map->mem = mem; 285 map->mem = mem;
282 mem->map = map; 286 mem->map = map;
@@ -296,12 +300,16 @@ static int uio_dev_add_attributes(struct uio_device *idev)
296 portio_found = 1; 300 portio_found = 1;
297 idev->portio_dir = kobject_create_and_add("portio", 301 idev->portio_dir = kobject_create_and_add("portio",
298 &idev->dev->kobj); 302 &idev->dev->kobj);
299 if (!idev->portio_dir) 303 if (!idev->portio_dir) {
304 ret = -ENOMEM;
300 goto err_portio; 305 goto err_portio;
306 }
301 } 307 }
302 portio = kzalloc(sizeof(*portio), GFP_KERNEL); 308 portio = kzalloc(sizeof(*portio), GFP_KERNEL);
303 if (!portio) 309 if (!portio) {
310 ret = -ENOMEM;
304 goto err_portio_kobj; 311 goto err_portio_kobj;
312 }
305 kobject_init(&portio->kobj, &portio_attr_type); 313 kobject_init(&portio->kobj, &portio_attr_type);
306 portio->port = port; 314 portio->port = port;
307 port->portio = portio; 315 port->portio = portio;