tee: amdtee: remove unused variable initialization
authorRijo Thomas <Rijo-john.Thomas@amd.com>
Thu, 9 Jan 2020 12:53:18 +0000 (18:23 +0530)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 16 Jan 2020 07:18:13 +0000 (15:18 +0800)
Remove unused variable initialization from driver code.

If enabled as a compiler option, compiler may throw warning for
unused assignments.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver")
Signed-off-by: Rijo Thomas <Rijo-john.Thomas@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/tee/amdtee/call.c
drivers/tee/amdtee/core.c

index 87ccad2..096dd4d 100644 (file)
@@ -124,8 +124,8 @@ static int amd_params_to_tee_params(struct tee_param *tee, u32 count,
 int handle_unload_ta(u32 ta_handle)
 {
        struct tee_cmd_unload_ta cmd = {0};
-       int ret = 0;
        u32 status;
+       int ret;
 
        if (!ta_handle)
                return -EINVAL;
@@ -145,8 +145,8 @@ int handle_unload_ta(u32 ta_handle)
 int handle_close_session(u32 ta_handle, u32 info)
 {
        struct tee_cmd_close_session cmd = {0};
-       int ret = 0;
        u32 status;
+       int ret;
 
        if (ta_handle == 0)
                return -EINVAL;
@@ -167,8 +167,8 @@ int handle_close_session(u32 ta_handle, u32 info)
 void handle_unmap_shmem(u32 buf_id)
 {
        struct tee_cmd_unmap_shared_mem cmd = {0};
-       int ret = 0;
        u32 status;
+       int ret;
 
        cmd.buf_id = buf_id;
 
@@ -183,7 +183,7 @@ int handle_invoke_cmd(struct tee_ioctl_invoke_arg *arg, u32 sinfo,
                      struct tee_param *p)
 {
        struct tee_cmd_invoke_cmd cmd = {0};
-       int ret = 0;
+       int ret;
 
        if (!arg || (!p && arg->num_params))
                return -EINVAL;
@@ -229,7 +229,7 @@ int handle_map_shmem(u32 count, struct shmem_desc *start, u32 *buf_id)
 {
        struct tee_cmd_map_shared_mem *cmd;
        phys_addr_t paddr;
-       int ret = 0, i;
+       int ret, i;
        u32 status;
 
        if (!count || !start || !buf_id)
@@ -294,7 +294,7 @@ int handle_open_session(struct tee_ioctl_open_session_arg *arg, u32 *info,
                        struct tee_param *p)
 {
        struct tee_cmd_open_session cmd = {0};
-       int ret = 0;
+       int ret;
 
        if (!arg || !info || (!p && arg->num_params))
                return -EINVAL;
@@ -342,7 +342,7 @@ int handle_load_ta(void *data, u32 size, struct tee_ioctl_open_session_arg *arg)
 {
        struct tee_cmd_load_ta cmd = {0};
        phys_addr_t blob;
-       int ret = 0;
+       int ret;
 
        if (size == 0 || !data || !arg)
                return -EINVAL;
index 9d0cee1..b3f8235 100644 (file)
@@ -50,7 +50,7 @@ static int amdtee_open(struct tee_context *ctx)
 
 static void release_session(struct amdtee_session *sess)
 {
-       int i = 0;
+       int i;
 
        /* Close any open session */
        for (i = 0; i < TEE_NUM_SESSIONS; ++i) {
@@ -173,7 +173,7 @@ static int copy_ta_binary(struct tee_context *ctx, void *ptr, void **ta,
                u16 hi_ver;
                u8 seq_n[8];
        } *uuid = ptr;
-       int n = 0, rc = 0;
+       int n, rc = 0;
 
        n = snprintf(fw_name, TA_PATH_MAX,
                     "%s/%08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x.bin",
@@ -219,9 +219,9 @@ int amdtee_open_session(struct tee_context *ctx,
        struct amdtee_context_data *ctxdata = ctx->data;
        struct amdtee_session *sess = NULL;
        u32 session_info;
-       void *ta = NULL;
        size_t ta_size;
-       int rc = 0, i;
+       int rc, i;
+       void *ta;
 
        if (arg->clnt_login != TEE_IOCTL_LOGIN_PUBLIC) {
                pr_err("unsupported client login method\n");
@@ -368,8 +368,8 @@ int amdtee_map_shmem(struct tee_shm *shm)
 
 void amdtee_unmap_shmem(struct tee_shm *shm)
 {
+       struct amdtee_shm_data *shmnode;
        u32 buf_id;
-       struct amdtee_shm_data *shmnode = NULL;
 
        if (!shm)
                return;
@@ -434,9 +434,9 @@ static const struct tee_desc amdtee_desc = {
 
 static int __init amdtee_driver_init(void)
 {
-       struct amdtee *amdtee = NULL;
        struct tee_device *teedev;
-       struct tee_shm_pool *pool = ERR_PTR(-EINVAL);
+       struct tee_shm_pool *pool;
+       struct amdtee *amdtee;
        int rc;
 
        rc = psp_check_tee_status();