summaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2015-03-26 10:46:35 +0000
committerRussell King <rmk+kernel@arm.linux.org.uk>2015-09-03 16:00:44 +0100
commit321ae9646bbfdf27550ecb65617322abc2b92052 (patch)
treeb77e52578752f4ca4d61e29adb07b1355b7d3a25 /drivers/pcmcia
parent924e5ea2ce0f6addb8b098760d840b0923573d19 (diff)
downloadlinux-321ae9646bbfdf27550ecb65617322abc2b92052.tar.gz
linux-321ae9646bbfdf27550ecb65617322abc2b92052.tar.bz2
linux-321ae9646bbfdf27550ecb65617322abc2b92052.zip
pcmcia: sa1111: simplify clk handing in sa1111_pcmcia_add()
clk_get(dev, NULL) will always refer to the same clock, so it's pointless calling this multiple times for the same device. As we no longer have to worry about the cleanup (via use of devm_clk_get()) we can simplify sa1111_pcmcia_add() too. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/sa1111_generic.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c
index fb902af8a5b7..a1531feb8460 100644
--- a/drivers/pcmcia/sa1111_generic.c
+++ b/drivers/pcmcia/sa1111_generic.c
@@ -135,8 +135,13 @@ int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops,
int (*add)(struct soc_pcmcia_socket *))
{
struct sa1111_pcmcia_socket *s;
+ struct clk *clk;
int i, ret = 0;
+ clk = devm_clk_get(&dev->dev, NULL);
+ if (IS_ERR(clk))
+ return PTR_ERR(clk);
+
ops->socket_state = sa1111_pcmcia_socket_state;
for (i = 0; i < ops->nr; i++) {
@@ -145,12 +150,8 @@ int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops,
return -ENOMEM;
s->soc.nr = ops->first + i;
- s->soc.clk = devm_clk_get(&dev->dev, NULL);
- if (IS_ERR(s->soc.clk)) {
- ret = PTR_ERR(s->soc.clk);
- kfree(s);
- return ret;
- }
+ s->soc.clk = clk;
+
soc_pcmcia_init_one(&s->soc, ops, &dev->dev);
s->dev = dev;
if (s->soc.nr) {