aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/pwrseq_simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/core/pwrseq_simple.c')
-rw-r--r--drivers/mmc/core/pwrseq_simple.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c
index c53f14a7ce54..0b14b83a53d6 100644
--- a/drivers/mmc/core/pwrseq_simple.c
+++ b/drivers/mmc/core/pwrseq_simple.c
@@ -85,7 +85,6 @@ static void mmc_pwrseq_simple_free(struct mmc_host *host)
85 clk_put(pwrseq->ext_clk); 85 clk_put(pwrseq->ext_clk);
86 86
87 kfree(pwrseq); 87 kfree(pwrseq);
88 host->pwrseq = NULL;
89} 88}
90 89
91static struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = { 90static struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = {
@@ -95,7 +94,8 @@ static struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = {
95 .free = mmc_pwrseq_simple_free, 94 .free = mmc_pwrseq_simple_free,
96}; 95};
97 96
98int mmc_pwrseq_simple_alloc(struct mmc_host *host, struct device *dev) 97struct mmc_pwrseq *mmc_pwrseq_simple_alloc(struct mmc_host *host,
98 struct device *dev)
99{ 99{
100 struct mmc_pwrseq_simple *pwrseq; 100 struct mmc_pwrseq_simple *pwrseq;
101 int i, nr_gpios, ret = 0; 101 int i, nr_gpios, ret = 0;
@@ -107,7 +107,7 @@ int mmc_pwrseq_simple_alloc(struct mmc_host *host, struct device *dev)
107 pwrseq = kzalloc(sizeof(struct mmc_pwrseq_simple) + nr_gpios * 107 pwrseq = kzalloc(sizeof(struct mmc_pwrseq_simple) + nr_gpios *
108 sizeof(struct gpio_desc *), GFP_KERNEL); 108 sizeof(struct gpio_desc *), GFP_KERNEL);
109 if (!pwrseq) 109 if (!pwrseq)
110 return -ENOMEM; 110 return ERR_PTR(-ENOMEM);
111 111
112 pwrseq->ext_clk = clk_get(dev, "ext_clock"); 112 pwrseq->ext_clk = clk_get(dev, "ext_clock");
113 if (IS_ERR(pwrseq->ext_clk) && 113 if (IS_ERR(pwrseq->ext_clk) &&
@@ -133,13 +133,12 @@ int mmc_pwrseq_simple_alloc(struct mmc_host *host, struct device *dev)
133 133
134 pwrseq->nr_gpios = nr_gpios; 134 pwrseq->nr_gpios = nr_gpios;
135 pwrseq->pwrseq.ops = &mmc_pwrseq_simple_ops; 135 pwrseq->pwrseq.ops = &mmc_pwrseq_simple_ops;
136 host->pwrseq = &pwrseq->pwrseq;
137 136
138 return 0; 137 return &pwrseq->pwrseq;
139clk_put: 138clk_put:
140 if (!IS_ERR(pwrseq->ext_clk)) 139 if (!IS_ERR(pwrseq->ext_clk))
141 clk_put(pwrseq->ext_clk); 140 clk_put(pwrseq->ext_clk);
142free: 141free:
143 kfree(pwrseq); 142 kfree(pwrseq);
144 return ret; 143 return ERR_PTR(ret);
145} 144}