Skip to content

Commit

Permalink
serial: amba-pl011: Fix devm_ioremap_resource return value check
Browse files Browse the repository at this point in the history
Value returned by devm_ioremap_resource() was checked for non-NULL but
devm_ioremap_resource() returns IOMEM_ERR_PTR, not NULL. In case of
error this could lead to dereference of ERR_PTR.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Cc: <stable@vger.kernel.org>
Fixes: 3873e2d ("drivers: PL011: refactor pl011_probe()")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Krzysztof Kozlowski authored and Greg Kroah-Hartman committed Jul 23, 2015
1 parent 3b19e03 commit 97a60ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/tty/serial/amba-pl011.c
Original file line number Diff line number Diff line change
Expand Up @@ -2310,8 +2310,8 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap,
void __iomem *base;

base = devm_ioremap_resource(dev, mmiobase);
if (!base)
return -ENOMEM;
if (IS_ERR(base))
return PTR_ERR(base);

index = pl011_probe_dt_alias(index, dev);

Expand Down

0 comments on commit 97a60ea

Please sign in to comment.