mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-05-03 11:56:51 -04:00
drm/i915: add a helper to free the members of i915_params
Abstract the one user in anticipation of more. Set the dangling pointers to NULL while at it. Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/8637d1e5049dc003718772f19d664aeaf9540856.1545920737.git.jani.nikula@intel.com
This commit is contained in:
@@ -963,17 +963,10 @@ static void i915_error_object_free(struct drm_i915_error_object *obj)
|
||||
kfree(obj);
|
||||
}
|
||||
|
||||
static __always_inline void free_param(const char *type, void *x)
|
||||
{
|
||||
if (!__builtin_strcmp(type, "char *"))
|
||||
kfree(*(void **)x);
|
||||
}
|
||||
|
||||
static void cleanup_params(struct i915_gpu_state *error)
|
||||
{
|
||||
#define FREE(T, x, ...) free_param(#T, &error->params.x);
|
||||
I915_PARAMS_FOR_EACH(FREE);
|
||||
#undef FREE
|
||||
i915_params_free(&error->params);
|
||||
}
|
||||
|
||||
static void cleanup_uc_state(struct i915_gpu_state *error)
|
||||
|
||||
Reference in New Issue
Block a user