cmd: mmc: don't assign unused values
[platform/kernel/u-boot.git] / cmd / tpm-common.c
index 42882b1..47adaff 100644 (file)
@@ -7,6 +7,7 @@
 #include <command.h>
 #include <dm.h>
 #include <env.h>
+#include <malloc.h>
 #include <asm/unaligned.h>
 #include <linux/string.h>
 #include <tpm-common.h>
@@ -45,7 +46,7 @@ void print_byte_string(u8 *data, size_t count)
  *                     NULL is passed, a large enough buffer will be allocated,
  *                     and the caller must free it.
  * @param count_ptr    output variable for the length of byte string
- * @return pointer to output buffer
+ * Return: pointer to output buffer
  */
 void *parse_byte_string(char *bytes, u8 *data, size_t *count_ptr)
 {
@@ -67,7 +68,7 @@ void *parse_byte_string(char *bytes, u8 *data, size_t *count_ptr)
        for (i = 0; i < length; i += 2) {
                byte[0] = bytes[i];
                byte[1] = bytes[i + 1];
-               data[i / 2] = (u8)simple_strtoul(byte, NULL, 16);
+               data[i / 2] = (u8)hextoul(byte, NULL);
        }
 
        if (count_ptr)
@@ -80,7 +81,7 @@ void *parse_byte_string(char *bytes, u8 *data, size_t *count_ptr)
  * report_return_code() - Report any error and return failure or success
  *
  * @param return_code  TPM command return code
- * @return value of enum command_ret_t
+ * Return: value of enum command_ret_t
  */
 int report_return_code(int return_code)
 {
@@ -96,7 +97,7 @@ int report_return_code(int return_code)
  * Return number of values defined by a type string.
  *
  * @param type_str     type string
- * @return number of values of type string
+ * Return: number of values of type string
  */
 int type_string_get_num_values(const char *type_str)
 {
@@ -107,7 +108,7 @@ int type_string_get_num_values(const char *type_str)
  * Return total size of values defined by a type string.
  *
  * @param type_str     type string
- * @return total size of values of type string, or 0 if type string
+ * Return: total size of values of type string, or 0 if type string
  *  contains illegal type character.
  */
 size_t type_string_get_space_size(const char *type_str)
@@ -139,7 +140,7 @@ size_t type_string_get_space_size(const char *type_str)
  *
  * @param type_str     type string
  * @param count                pointer for storing size of buffer
- * @return pointer to buffer or NULL on error
+ * Return: pointer to buffer or NULL on error
  */
 void *type_string_alloc(const char *type_str, u32 *count)
 {
@@ -163,7 +164,7 @@ void *type_string_alloc(const char *type_str, u32 *count)
  * @param type_str     type string
  * @param values       text strings of values to be packed
  * @param data         output buffer of values
- * @return 0 on success, non-0 on error
+ * Return: 0 on success, non-0 on error
  */
 int type_string_pack(const char *type_str, char * const values[],
                     u8 *data)
@@ -201,7 +202,7 @@ int type_string_pack(const char *type_str, char * const values[],
  * @param type_str     type string
  * @param data         input buffer of values
  * @param vars         names of environment variables
- * @return 0 on success, non-0 on error
+ * Return: 0 on success, non-0 on error
  */
 int type_string_write_vars(const char *type_str, u8 *data,
                           char * const vars[])
@@ -295,13 +296,13 @@ int get_tpm(struct udevice **devp)
        return 0;
 }
 
-int do_tpm_device(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_tpm_device(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
        unsigned long num;
        int rc;
 
        if (argc == 2) {
-               num = simple_strtoul(argv[1], NULL, 10);
+               num = dectoul(argv[1], NULL);
 
                rc = tpm_set_device(num);
                if (rc)
@@ -313,7 +314,7 @@ int do_tpm_device(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
        return rc;
 }
 
-int do_tpm_info(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_tpm_info(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
        struct udevice *dev;
        char buf[80];
@@ -332,7 +333,7 @@ int do_tpm_info(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
        return 0;
 }
 
-int do_tpm_init(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_tpm_init(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
        struct udevice *dev;
        int rc;
@@ -346,9 +347,9 @@ int do_tpm_init(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        return report_return_code(tpm_init(dev));
 }
 
-int do_tpm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_tpm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-       cmd_tbl_t *tpm_commands, *cmd;
+       struct cmd_tbl *tpm_commands, *cmd;
        struct tpm_chip_priv *priv;
        struct udevice *dev;
        unsigned int size;