diff mbox series

[next] accel/qaic: remove redundant assignment to pointer pexec

Message ID 20230725114037.36806-1-colin.i.king@gmail.com
State New
Headers show
Series [next] accel/qaic: remove redundant assignment to pointer pexec | expand

Commit Message

Colin Ian King July 25, 2023, 11:40 a.m. UTC
Pointer pexec is being assigned a value however it is never read. The
assignment is redundant and can be removed.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/accel/qaic/qaic_data.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Jeffrey Hugo July 26, 2023, 3 a.m. UTC | #1
On 7/25/2023 5:40 AM, Colin Ian King wrote:
> Pointer pexec is being assigned a value however it is never read. The
> assignment is redundant and can be removed.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>   drivers/accel/qaic/qaic_data.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c
> index e9a1cb779b30..8a6cb14f490e 100644
> --- a/drivers/accel/qaic/qaic_data.c
> +++ b/drivers/accel/qaic/qaic_data.c
> @@ -1320,7 +1320,6 @@ static int __qaic_execute_bo_ioctl(struct drm_device *dev, void *data, struct dr
>   	user_data = u64_to_user_ptr(args->data);
>   
>   	exec = kcalloc(args->hdr.count, size, GFP_KERNEL);
> -	pexec = (struct qaic_partial_execute_entry *)exec;
>   	if (!exec)
>   		return -ENOMEM;
>   

It does look like pexec is not used in this function after it was 
refactored.  Shouldn't the declaration at the beginning of the function 
also be removed?
Pranjal Ramajor Asha Kanojiya July 26, 2023, 1:38 p.m. UTC | #2
On 7/26/2023 8:30 AM, Jeffrey Hugo wrote:
> On 7/25/2023 5:40 AM, Colin Ian King wrote:
>> Pointer pexec is being assigned a value however it is never read. The
>> assignment is redundant and can be removed.
>>
>> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
>> ---
>>   drivers/accel/qaic/qaic_data.c | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/accel/qaic/qaic_data.c 
>> b/drivers/accel/qaic/qaic_data.c
>> index e9a1cb779b30..8a6cb14f490e 100644
>> --- a/drivers/accel/qaic/qaic_data.c
>> +++ b/drivers/accel/qaic/qaic_data.c
>> @@ -1320,7 +1320,6 @@ static int __qaic_execute_bo_ioctl(struct 
>> drm_device *dev, void *data, struct dr
>>       user_data = u64_to_user_ptr(args->data);
>>       exec = kcalloc(args->hdr.count, size, GFP_KERNEL);
>> -    pexec = (struct qaic_partial_execute_entry *)exec;
>>       if (!exec)
>>           return -ENOMEM;
> 
> It does look like pexec is not used in this function after it was 
> refactored.  Shouldn't the declaration at the beginning of the function 
> also be removed?

Yeah we should remove the declaration as well. Although it is used some 
where to calculate its size i.e. sizeof(*pexec). We need to directly use 
the type in sizeof() i.e. sizeof(struct qaic_partial_execute_entry).
Colin Ian King July 26, 2023, 1:52 p.m. UTC | #3
On 26/07/2023 14:38, Pranjal Ramajor Asha Kanojiya wrote:
> 
> 
> On 7/26/2023 8:30 AM, Jeffrey Hugo wrote:
>> On 7/25/2023 5:40 AM, Colin Ian King wrote:
>>> Pointer pexec is being assigned a value however it is never read. The
>>> assignment is redundant and can be removed.
>>>
>>> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
>>> ---
>>>   drivers/accel/qaic/qaic_data.c | 1 -
>>>   1 file changed, 1 deletion(-)
>>>
>>> diff --git a/drivers/accel/qaic/qaic_data.c 
>>> b/drivers/accel/qaic/qaic_data.c
>>> index e9a1cb779b30..8a6cb14f490e 100644
>>> --- a/drivers/accel/qaic/qaic_data.c
>>> +++ b/drivers/accel/qaic/qaic_data.c
>>> @@ -1320,7 +1320,6 @@ static int __qaic_execute_bo_ioctl(struct 
>>> drm_device *dev, void *data, struct dr
>>>       user_data = u64_to_user_ptr(args->data);
>>>       exec = kcalloc(args->hdr.count, size, GFP_KERNEL);
>>> -    pexec = (struct qaic_partial_execute_entry *)exec;
>>>       if (!exec)
>>>           return -ENOMEM;
>>
>> It does look like pexec is not used in this function after it was 
>> refactored.  Shouldn't the declaration at the beginning of the 
>> function also be removed?
> 
> Yeah we should remove the declaration as well. Although it is used some 
> where to calculate its size i.e. sizeof(*pexec). We need to directly use 
> the type in sizeof() i.e. sizeof(struct qaic_partial_execute_entry).

I didn't remove the variable because of the sizeof(), but it makes sense 
to remove it. I'll send a V2 today
diff mbox series

Patch

diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c
index e9a1cb779b30..8a6cb14f490e 100644
--- a/drivers/accel/qaic/qaic_data.c
+++ b/drivers/accel/qaic/qaic_data.c
@@ -1320,7 +1320,6 @@  static int __qaic_execute_bo_ioctl(struct drm_device *dev, void *data, struct dr
 	user_data = u64_to_user_ptr(args->data);
 
 	exec = kcalloc(args->hdr.count, size, GFP_KERNEL);
-	pexec = (struct qaic_partial_execute_entry *)exec;
 	if (!exec)
 		return -ENOMEM;