diff options
-rw-r--r-- | drivers/tty/serial/amba-pl011.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index d7e1edec50b5..7fca4022a8b2 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
@@ -56,8 +56,7 @@ | |||
56 | #include <linux/of_device.h> | 56 | #include <linux/of_device.h> |
57 | #include <linux/pinctrl/consumer.h> | 57 | #include <linux/pinctrl/consumer.h> |
58 | #include <linux/sizes.h> | 58 | #include <linux/sizes.h> |
59 | 59 | #include <linux/io.h> | |
60 | #include <asm/io.h> | ||
61 | 60 | ||
62 | #define UART_NR 14 | 61 | #define UART_NR 14 |
63 | 62 | ||
@@ -1973,7 +1972,8 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
1973 | goto out; | 1972 | goto out; |
1974 | } | 1973 | } |
1975 | 1974 | ||
1976 | uap = kzalloc(sizeof(struct uart_amba_port), GFP_KERNEL); | 1975 | uap = devm_kzalloc(&dev->dev, sizeof(struct uart_amba_port), |
1976 | GFP_KERNEL); | ||
1977 | if (uap == NULL) { | 1977 | if (uap == NULL) { |
1978 | ret = -ENOMEM; | 1978 | ret = -ENOMEM; |
1979 | goto out; | 1979 | goto out; |
@@ -1981,16 +1981,17 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
1981 | 1981 | ||
1982 | i = pl011_probe_dt_alias(i, &dev->dev); | 1982 | i = pl011_probe_dt_alias(i, &dev->dev); |
1983 | 1983 | ||
1984 | base = ioremap(dev->res.start, resource_size(&dev->res)); | 1984 | base = devm_ioremap(&dev->dev, dev->res.start, |
1985 | resource_size(&dev->res)); | ||
1985 | if (!base) { | 1986 | if (!base) { |
1986 | ret = -ENOMEM; | 1987 | ret = -ENOMEM; |
1987 | goto free; | 1988 | goto out; |
1988 | } | 1989 | } |
1989 | 1990 | ||
1990 | uap->pinctrl = devm_pinctrl_get(&dev->dev); | 1991 | uap->pinctrl = devm_pinctrl_get(&dev->dev); |
1991 | if (IS_ERR(uap->pinctrl)) { | 1992 | if (IS_ERR(uap->pinctrl)) { |
1992 | ret = PTR_ERR(uap->pinctrl); | 1993 | ret = PTR_ERR(uap->pinctrl); |
1993 | goto unmap; | 1994 | goto out; |
1994 | } | 1995 | } |
1995 | uap->pins_default = pinctrl_lookup_state(uap->pinctrl, | 1996 | uap->pins_default = pinctrl_lookup_state(uap->pinctrl, |
1996 | PINCTRL_STATE_DEFAULT); | 1997 | PINCTRL_STATE_DEFAULT); |
@@ -2002,10 +2003,10 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
2002 | if (IS_ERR(uap->pins_sleep)) | 2003 | if (IS_ERR(uap->pins_sleep)) |
2003 | dev_dbg(&dev->dev, "could not get sleep pinstate\n"); | 2004 | dev_dbg(&dev->dev, "could not get sleep pinstate\n"); |
2004 | 2005 | ||
2005 | uap->clk = clk_get(&dev->dev, NULL); | 2006 | uap->clk = devm_clk_get(&dev->dev, NULL); |
2006 | if (IS_ERR(uap->clk)) { | 2007 | if (IS_ERR(uap->clk)) { |
2007 | ret = PTR_ERR(uap->clk); | 2008 | ret = PTR_ERR(uap->clk); |
2008 | goto unmap; | 2009 | goto out; |
2009 | } | 2010 | } |
2010 | 2011 | ||
2011 | uap->vendor = vendor; | 2012 | uap->vendor = vendor; |
@@ -2038,11 +2039,6 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
2038 | amba_set_drvdata(dev, NULL); | 2039 | amba_set_drvdata(dev, NULL); |
2039 | amba_ports[i] = NULL; | 2040 | amba_ports[i] = NULL; |
2040 | pl011_dma_remove(uap); | 2041 | pl011_dma_remove(uap); |
2041 | clk_put(uap->clk); | ||
2042 | unmap: | ||
2043 | iounmap(base); | ||
2044 | free: | ||
2045 | kfree(uap); | ||
2046 | } | 2042 | } |
2047 | out: | 2043 | out: |
2048 | return ret; | 2044 | return ret; |
@@ -2062,9 +2058,6 @@ static int pl011_remove(struct amba_device *dev) | |||
2062 | amba_ports[i] = NULL; | 2058 | amba_ports[i] = NULL; |
2063 | 2059 | ||
2064 | pl011_dma_remove(uap); | 2060 | pl011_dma_remove(uap); |
2065 | iounmap(uap->port.membase); | ||
2066 | clk_put(uap->clk); | ||
2067 | kfree(uap); | ||
2068 | return 0; | 2061 | return 0; |
2069 | } | 2062 | } |
2070 | 2063 | ||