diff options
Diffstat (limited to 'drivers/mmc/core/pwrseq.c')
-rw-r--r-- | drivers/mmc/core/pwrseq.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/mmc/core/pwrseq.c b/drivers/mmc/core/pwrseq.c index 862356123d78..ab2129781161 100644 --- a/drivers/mmc/core/pwrseq.c +++ b/drivers/mmc/core/pwrseq.c | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | struct mmc_pwrseq_match { | 20 | struct mmc_pwrseq_match { |
21 | const char *compatible; | 21 | const char *compatible; |
22 | int (*alloc)(struct mmc_host *host, struct device *dev); | 22 | struct mmc_pwrseq *(*alloc)(struct mmc_host *host, struct device *dev); |
23 | }; | 23 | }; |
24 | 24 | ||
25 | static struct mmc_pwrseq_match pwrseq_match[] = { | 25 | static struct mmc_pwrseq_match pwrseq_match[] = { |
@@ -52,6 +52,7 @@ int mmc_pwrseq_alloc(struct mmc_host *host) | |||
52 | struct platform_device *pdev; | 52 | struct platform_device *pdev; |
53 | struct device_node *np; | 53 | struct device_node *np; |
54 | struct mmc_pwrseq_match *match; | 54 | struct mmc_pwrseq_match *match; |
55 | struct mmc_pwrseq *pwrseq; | ||
55 | int ret = 0; | 56 | int ret = 0; |
56 | 57 | ||
57 | np = of_parse_phandle(host->parent->of_node, "mmc-pwrseq", 0); | 58 | np = of_parse_phandle(host->parent->of_node, "mmc-pwrseq", 0); |
@@ -70,9 +71,14 @@ int mmc_pwrseq_alloc(struct mmc_host *host) | |||
70 | goto err; | 71 | goto err; |
71 | } | 72 | } |
72 | 73 | ||
73 | ret = match->alloc(host, &pdev->dev); | 74 | pwrseq = match->alloc(host, &pdev->dev); |
74 | if (!ret) | 75 | if (IS_ERR(pwrseq)) { |
75 | dev_info(host->parent, "allocated mmc-pwrseq\n"); | 76 | ret = PTR_ERR(host->pwrseq); |
77 | goto err; | ||
78 | } | ||
79 | |||
80 | host->pwrseq = pwrseq; | ||
81 | dev_info(host->parent, "allocated mmc-pwrseq\n"); | ||
76 | 82 | ||
77 | err: | 83 | err: |
78 | of_node_put(np); | 84 | of_node_put(np); |
@@ -109,4 +115,6 @@ void mmc_pwrseq_free(struct mmc_host *host) | |||
109 | 115 | ||
110 | if (pwrseq && pwrseq->ops && pwrseq->ops->free) | 116 | if (pwrseq && pwrseq->ops && pwrseq->ops->free) |
111 | pwrseq->ops->free(host); | 117 | pwrseq->ops->free(host); |
118 | |||
119 | host->pwrseq = NULL; | ||
112 | } | 120 | } |