[PATCH i-g-t 2/2] lib/intel_bufops: Don't memcpy() simple structs

Ville Syrjala ville.syrjala at linux.intel.com
Thu Dec 7 17:11:36 UTC 2023


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Just use a regular assignment when possible instead of
complicating things with memcpy().

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 lib/intel_bufops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
index 46eba3fb43a2..6ceea55caa81 100644
--- a/lib/intel_bufops.c
+++ b/lib/intel_bufops.c
@@ -1498,7 +1498,7 @@ static struct buf_ops *__buf_ops_create(int fd, bool check_idempotency)
 	for (int i = 0; i < ARRAY_SIZE(buf_ops_arr); i++) {
 		if (generation >= buf_ops_arr[i].gen_start &&
 		    generation <= buf_ops_arr[i].gen_end) {
-			memcpy(bops, &buf_ops_arr[i], sizeof(*bops));
+			*bops = buf_ops_arr[i];
 			break;
 		}
 	}
-- 
2.41.0



More information about the igt-dev mailing list