Message ID | 20170709090510.GA145826@lkp-ib03.lkp.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
--- a/drivers/gpu/drm/i915/i915_perf.c +++ b/drivers/gpu/drm/i915/i915_perf.c @@ -3309,12 +3309,9 @@ int i915_perf_remove_config_ioctl(struct sysfs_remove_group(dev_priv->perf.metrics_kobj, &oa_config->sysfs_metric); - if (oa_config->flex_regs) - kfree(oa_config->flex_regs); - if (oa_config->b_counter_regs) - kfree(oa_config->b_counter_regs); - if (oa_config->mux_regs) - kfree(oa_config->mux_regs); + kfree(oa_config->flex_regs); + kfree(oa_config->b_counter_regs); + kfree(oa_config->mux_regs); kfree(oa_config); config_err:
drivers/gpu/drm/i915/i915_perf.c:3313:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values. drivers/gpu/drm/i915/i915_perf.c:3315:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values. drivers/gpu/drm/i915/i915_perf.c:3317:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values. NULL check before some freeing functions is not needed. Based on checkpatch warning "kfree(NULL) is safe this check is probably not required" and kfreeaddr.cocci by Julia Lawall. Generated by: scripts/coccinelle/free/ifnullfree.cocci Fixes: 7f475c52e3f8 ("drm/i915: Implement I915_PERF_ADD/REMOVE_CONFIG interface") CC: Matthew Auld <matthew.auld@intel.com> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> --- i915_perf.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)