carl9170 tools: fix error code propagation
[carl9170fw.git] / tools / src / eeprom_fix.c
index 7f28179a4acbab43d975ffdc9d2357af1c811113..088510edcc87e60b6ac0dc318590a7ff48232def 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2010, Christian Lamparter <chunkeey@googlemail.com>
+ * Copyright 2010-2011 Christian Lamparter <chunkeey@googlemail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -51,7 +51,7 @@ static int get_addr(char *str, unsigned int *val)
                return -EINVAL;
        }
 
-       return 0;
+       return err;
 }
 
 static int
@@ -275,8 +275,9 @@ int main(int argc, char *args[])
 
        fw = carlfw_load(args[1]);
        if (IS_ERR_OR_NULL(fw)) {
+               err = PTR_ERR(fw);
                fprintf(stderr, "Failed to open file \"%s\" (%d).\n",
-                       args[1], (int) PTR_ERR(fw));
+                       args[1], err);
                goto out;
        }