Skip to content

Commit

Permalink
ACPI / LPSS: Fix up acpi_lpss_create_device()
Browse files Browse the repository at this point in the history
Fix a return value (which should be a negative error code) and a
memory leak (the list allocated by acpi_dev_get_resources() needs
to be freed on ioremap() errors too) in acpi_lpss_create_device()
introduced by commit 4483d59 'ACPI / LPSS: check the result
of ioremap()'.

Fixes: 4483d59 'ACPI / LPSS: check the result of ioremap()'
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: 4.0+ <stable@vger.kernel.org> # 4.0+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Rafael J. Wysocki committed Jul 6, 2015
1 parent d770e55 commit d3e13ff
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/acpi/acpi_lpss.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,16 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
pdata->mmio_size = resource_size(rentry->res);
pdata->mmio_base = ioremap(rentry->res->start,
pdata->mmio_size);
if (!pdata->mmio_base)
goto err_out;
break;
}

acpi_dev_free_resource_list(&resource_list);

if (!pdata->mmio_base) {
ret = -ENOMEM;
goto err_out;
}

pdata->dev_desc = dev_desc;

if (dev_desc->setup)
Expand Down

0 comments on commit d3e13ff

Please sign in to comment.