On 03/14/2014 05:16 PM, Wolfgang Denk wrote:
Dear Przemyslaw Marczak,

In message 
<e7d9246677ecb9a8c774e9e5f8d31ae3fd53d487.1394807506.git.p.marc...@samsung.com> 
you wrote:
Changes:
- randomly generate partition uuid if any is undefined
- print info about set/unset/generated uuid
- update doc/README.gpt
...
+       int ret = -1;
        char *e, *s;
+       char uuid_str[37];

Should we not rather use a #defined macro here instead of the magic
number 37 ?


Ok, then I create proper header for uuid: "include/uuid.h"

-                       printf("Environmental '%s' not set\n", str);
-                       return -1; /* env not set */
+                       printf("%s ", str);
+                       gen_rand_uuid_str(uuid_str);
+                       setenv(s, uuid_str);
+
+                       e = getenv(s);
+                       if (e) {
+                               puts("set to random.\n");

Can we keep the "var not set" part, so the user understands why U-Boot
assigns a random ID here?


Ok, I will add this info.

+               } else {
+                       printf("%s get from environment.\n", str);

Make this debug() ?

+               puts("Writing GPT:\n");
+
+               ret = gpt_default(blk_dev_desc, argv[4]);
+               if (!ret) {
+                       puts("success!\n");
+                       return CMD_RET_SUCCESS;
+               } else {
+                       puts("error!\n");
                        return CMD_RET_FAILURE;

This code is too verbose - I suggest to turn all these puts() into
debug().

Ok.

        } else {
                return CMD_RET_USAGE;
        }

Please invert the logic so you can bail out early and reduce the
indentation level.

Ok.

Best regards,

Wolfgang Denk

This can be changed to debug(), but I leave print error/success info when command finish.

Thanks
--
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marc...@samsung.com
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to