Skip to contentSkip to conversation

accel/qaic: remove redundant assignment to pointer pexec

PATCH Superseded Colin Ian King 4 participants 5 messages Jul 25, 2023 – Jul 26, 2023

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 accel/qaic: remove redundant assignment to pointer pexec

Pointer pexec is being assigned a value however it is never read. The assignment is redundant and can be removed.

---
 drivers/accel/qaic/qaic_data.c | 1 -
 1 file changed, 1 deletion(-)
drivers/accel/qaic/qaic_data.c +0 -1
index e9a1cb779b30..8a6cb14f490e 100644
@@ -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;
 
Signature · 1 line
2.39.2
#2 lore raw
In reply to Colin Ian King
Quoted 13 lines · Colin Ian King

Pointer pexec is being assigned a value however it is never read. The assignment is redundant and can be removed.

---
  drivers/accel/qaic/qaic_data.c | 1 -
  1 file changed, 1 deletion(-)
drivers/accel/qaic/qaic_data.c +0 -0
index e9a1cb779b30..8a6cb14f490e 100644

drivers/accel/qaic/qaic_data.c static int __qaic_execute_bo_ioctl(struct drm_device *dev, void *data, struct dr · line 1325

Quoted 7 lines
drivers/accel/qaic/qaic_data.c +0 -1
@@ -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?

#3 lore raw
Quoted 9 lines · Jeffrey Hugo
Quoted 8 lines · Colin Ian King

Pointer pexec is being assigned a value however it is never read. The assignment is redundant and can be removed.

---
  drivers/accel/qaic/qaic_data.c | 1 -

  1 file changed, 1 deletion(-)
Quoted 13 lines
Quoted 11 lines
drivers/accel/qaic/qaic_data.c +0 -0
index e9a1cb779b30..8a6cb14f490e 100644
@@ -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).

#4 lore raw
Quoted 26 lines · Pranjal Ramajor Asha Kanojiya
Quoted 9 lines · Jeffrey Hugo
Quoted 8 lines · Colin Ian King

Pointer pexec is being assigned a value however it is never read. The assignment is redundant and can be removed.

---
  drivers/accel/qaic/qaic_data.c | 1 -

  1 file changed, 1 deletion(-)
Quoted 13 lines
Quoted 11 lines
drivers/accel/qaic/qaic_data.c +0 -0
index e9a1cb779b30..8a6cb14f490e 100644
@@ -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?

Quoted 1 line

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