diff options
author | Olof Johansson <olof@lixom.net> | 2013-09-05 15:30:52 -0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2013-09-09 20:14:09 -0400 |
commit | d5ece9373c6e0f95ae59f303810e1ccbcd044629 (patch) | |
tree | 18e7326ccb9cc58e417e1b9a651a4da8d2ca88ae /arch/arm/plat-pxa | |
parent | 640414171818c6293c23e74a28d1c69b2a1a7fe5 (diff) |
ARM: pxa: ssp: Check return values from phandle lookups
Commit a6e56c28a178cef5f (ARM: pxa: ssp: add DT bindings) causes warnings
when built:
arch/arm/plat-pxa/ssp.c: In function 'pxa_ssp_probe':
arch/arm/plat-pxa/ssp.c:145:17: warning: 'dma_spec.args[0]' may be used
uninitialized in this function [-Wmaybe-uninitialized]
Resolve by checking return values and aborting when lookups fail.
Cc: Daniel Mack <zonque@gmail.com>
Cc: Mark Brown <broonie@linaro.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/plat-pxa')
-rw-r--r-- | arch/arm/plat-pxa/ssp.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c index c83f27b6bdda..3ea02903d75a 100644 --- a/arch/arm/plat-pxa/ssp.c +++ b/arch/arm/plat-pxa/ssp.c | |||
@@ -132,6 +132,7 @@ static int pxa_ssp_probe(struct platform_device *pdev) | |||
132 | if (dev->of_node) { | 132 | if (dev->of_node) { |
133 | struct of_phandle_args dma_spec; | 133 | struct of_phandle_args dma_spec; |
134 | struct device_node *np = dev->of_node; | 134 | struct device_node *np = dev->of_node; |
135 | int ret; | ||
135 | 136 | ||
136 | /* | 137 | /* |
137 | * FIXME: we should allocate the DMA channel from this | 138 | * FIXME: we should allocate the DMA channel from this |
@@ -140,14 +141,23 @@ static int pxa_ssp_probe(struct platform_device *pdev) | |||
140 | */ | 141 | */ |
141 | 142 | ||
142 | /* rx */ | 143 | /* rx */ |
143 | of_parse_phandle_with_args(np, "dmas", "#dma-cells", | 144 | ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", |
144 | 0, &dma_spec); | 145 | 0, &dma_spec); |
146 | |||
147 | if (ret) { | ||
148 | dev_err(dev, "Can't parse dmas property\n"); | ||
149 | return -ENODEV; | ||
150 | } | ||
145 | ssp->drcmr_rx = dma_spec.args[0]; | 151 | ssp->drcmr_rx = dma_spec.args[0]; |
146 | of_node_put(dma_spec.np); | 152 | of_node_put(dma_spec.np); |
147 | 153 | ||
148 | /* tx */ | 154 | /* tx */ |
149 | of_parse_phandle_with_args(np, "dmas", "#dma-cells", | 155 | ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", |
150 | 1, &dma_spec); | 156 | 1, &dma_spec); |
157 | if (ret) { | ||
158 | dev_err(dev, "Can't parse dmas property\n"); | ||
159 | return -ENODEV; | ||
160 | } | ||
151 | ssp->drcmr_tx = dma_spec.args[0]; | 161 | ssp->drcmr_tx = dma_spec.args[0]; |
152 | of_node_put(dma_spec.np); | 162 | of_node_put(dma_spec.np); |
153 | } else { | 163 | } else { |