diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2014-10-29 17:50:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-29 19:33:14 -0400 |
commit | 47f29df7db78ee4fcdb104cf36918d987ddd0278 (patch) | |
tree | dddc4e6874daebe2258972f2aa17a7a2c0ac6aa9 /drivers/of | |
parent | 5ddacbe92b806cd5b4f8f154e8e46ac267fff55c (diff) |
drivers: of: add return value to of_reserved_mem_device_init()
Driver calling of_reserved_mem_device_init() might be interested if the
initialization has been successful or not, so add support for returning
error code.
This fixes a build warining caused by commit 7bfa5ab6fa1b ("drivers:
dma-coherent: add initialization from device tree"), which has been
merged without this change and without fixing function return value.
Fixes: 7bfa5ab6fa1b1 ("drivers: dma-coherent: add initialization from device tree")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Laura Abbott <lauraa@codeaurora.org>
Cc: Josh Cartwright <joshc@codeaurora.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/of_reserved_mem.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 59fb12e84e6b..dc566b38645f 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c | |||
@@ -243,23 +243,27 @@ static inline struct reserved_mem *__find_rmem(struct device_node *node) | |||
243 | * This function assign memory region pointed by "memory-region" device tree | 243 | * This function assign memory region pointed by "memory-region" device tree |
244 | * property to the given device. | 244 | * property to the given device. |
245 | */ | 245 | */ |
246 | void of_reserved_mem_device_init(struct device *dev) | 246 | int of_reserved_mem_device_init(struct device *dev) |
247 | { | 247 | { |
248 | struct reserved_mem *rmem; | 248 | struct reserved_mem *rmem; |
249 | struct device_node *np; | 249 | struct device_node *np; |
250 | int ret; | ||
250 | 251 | ||
251 | np = of_parse_phandle(dev->of_node, "memory-region", 0); | 252 | np = of_parse_phandle(dev->of_node, "memory-region", 0); |
252 | if (!np) | 253 | if (!np) |
253 | return; | 254 | return -ENODEV; |
254 | 255 | ||
255 | rmem = __find_rmem(np); | 256 | rmem = __find_rmem(np); |
256 | of_node_put(np); | 257 | of_node_put(np); |
257 | 258 | ||
258 | if (!rmem || !rmem->ops || !rmem->ops->device_init) | 259 | if (!rmem || !rmem->ops || !rmem->ops->device_init) |
259 | return; | 260 | return -EINVAL; |
261 | |||
262 | ret = rmem->ops->device_init(rmem, dev); | ||
263 | if (ret == 0) | ||
264 | dev_info(dev, "assigned reserved memory node %s\n", rmem->name); | ||
260 | 265 | ||
261 | rmem->ops->device_init(rmem, dev); | 266 | return ret; |
262 | dev_info(dev, "assigned reserved memory node %s\n", rmem->name); | ||
263 | } | 267 | } |
264 | 268 | ||
265 | /** | 269 | /** |