diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2016-04-01 14:04:23 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-05-01 14:11:12 -0700 |
commit | 0320a278b9ef80cfa44f74b7f9bb36781695f3ee (patch) | |
tree | 1f13df91e2af7f99ca55ef9cc0c9a7b7aceeefe4 /drivers/uio | |
parent | 2fad622483707825222d2c38acb368681c75bbaa (diff) | |
download | lwn-0320a278b9ef80cfa44f74b7f9bb36781695f3ee.tar.gz lwn-0320a278b9ef80cfa44f74b7f9bb36781695f3ee.zip |
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>
Diffstat (limited to 'drivers/uio')
-rw-r--r-- | drivers/uio/uio.c | 16 |
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) map_found = 1; idev->map_dir = kobject_create_and_add("maps", &idev->dev->kobj); - if (!idev->map_dir) + if (!idev->map_dir) { + ret = -ENOMEM; goto err_map; + } } map = kzalloc(sizeof(*map), GFP_KERNEL); - if (!map) + if (!map) { + ret = -ENOMEM; goto err_map_kobj; + } kobject_init(&map->kobj, &map_attr_type); map->mem = mem; mem->map = map; @@ -296,12 +300,16 @@ static int uio_dev_add_attributes(struct uio_device *idev) portio_found = 1; idev->portio_dir = kobject_create_and_add("portio", &idev->dev->kobj); - if (!idev->portio_dir) + if (!idev->portio_dir) { + ret = -ENOMEM; goto err_portio; + } } portio = kzalloc(sizeof(*portio), GFP_KERNEL); - if (!portio) + if (!portio) { + ret = -ENOMEM; goto err_portio_kobj; + } kobject_init(&portio->kobj, &portio_attr_type); portio->port = port; port->portio = portio; |