mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-27 04:22:58 +00:00
drm/i915/selftests: fix smatch warning in mock_reserve
If mock_region_create fails then mem will be an error pointer. Instead we just need to use the correct ordering for the onion unwind. igt_mock_reserve() error: 'mem' dereferencing possible ERR_PTR() Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Matthew Auld <matthew.auld@intel.com> Reviewed-by: Ramalingam C <ramalingam.c@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210702104642.1189978-2-matthew.auld@intel.com
This commit is contained in:
@@ -173,7 +173,7 @@ static int igt_mock_reserve(void *arg)
|
||||
if (IS_ERR(mem)) {
|
||||
pr_err("failed to create memory region\n");
|
||||
err = PTR_ERR(mem);
|
||||
goto out_close;
|
||||
goto out_free_order;
|
||||
}
|
||||
|
||||
/* Reserve a bunch of ranges within the region */
|
||||
@@ -224,9 +224,10 @@ static int igt_mock_reserve(void *arg)
|
||||
}
|
||||
|
||||
out_close:
|
||||
kfree(order);
|
||||
close_objects(mem, &objects);
|
||||
intel_memory_region_put(mem);
|
||||
out_free_order:
|
||||
kfree(order);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user