[PATCH 4/7] memory commands: cleanup initialization
Sascha Hauer
s.hauer at pengutronix.de
Wed Apr 17 07:39:05 EDT 2013
- return -ENOMEM instead of -1
- return the result of platform_driver_register
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
commands/mem.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/commands/mem.c b/commands/mem.c
index d48f92e..5bef3f7 100644
--- a/commands/mem.c
+++ b/commands/mem.c
@@ -567,15 +567,10 @@ static struct driver_d mem_drv = {
static int mem_init(void)
{
rw_buf = malloc(RW_BUF_SIZE);
- if(!rw_buf) {
- printf("%s: Out of memory\n", __FUNCTION__);
- return -1;
- }
+ if(!rw_buf)
+ return -ENOMEM;
add_mem_device("mem", 0, ~0, IORESOURCE_MEM_WRITEABLE);
- platform_driver_register(&mem_drv);
-
- return 0;
+ return platform_driver_register(&mem_drv);
}
-
device_initcall(mem_init);
--
1.8.2.rc2
More information about the barebox
mailing list