Re: [PATCH v2] tee: amdtee: unload TA only when its refcount becomes 0
From: Rijo Thomas
Date: Mon Apr 12 2021 - 06:16:09 EST
On 09/04/21 2:15 pm, Dan Carpenter wrote:
> On Mon, Apr 05, 2021 at 03:13:09PM +0530, Rijo Thomas wrote:
>> @@ -340,7 +398,8 @@ int handle_open_session(struct tee_ioctl_open_session_arg *arg, u32 *info,
>>
>> int handle_load_ta(void *data, u32 size, struct tee_ioctl_open_session_arg *arg)
>> {
>> - struct tee_cmd_load_ta cmd = {0};
>> + struct tee_cmd_unload_ta unload_cmd = {0};
>> + struct tee_cmd_load_ta load_cmd = {0};
>
> It's better style to write:
>
> struct tee_cmd_unload_ta unload_cmd = {};
>
> It doesn't make a difference in this case, but if the first struct
> member is a pointer then {0} can generate a Sparse warning. Or
> depending on which bugs your version of GCC has it can affect whether
> struct holes are initialized. But mostly it's just the prefered style.
>
Hi Dan,
We do not have any pointers nor do I see a possibility of structure holes, since all data
members are u32 in both struct tee_cmd_load_ta and struct tee_cmd_unload_ta. So, will prefer
to use {0} for now.
Thanks,
Rijo
>
> regards,
> dan carpenter
>