[Intel-gfx] [PATCH v4 1/3] drm/i915/perf: remove generated code

Dan Carpenter dan.carpenter at oracle.com
Thu Mar 12 13:51:24 UTC 2020


Hi Lionel,

Thank you for the patch! Perhaps something to improve:

url:    https://github.com/0day-ci/linux/commits/Lionel-Landwerlin/drm-i915-perf-remove-generated-code/20200307-024544
base:   git://anongit.freedesktop.org/drm-intel for-linux-next

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>
Reported-by: Dan Carpenter <dan.carpenter at oracle.com>

smatch warnings:
drivers/gpu/drm/i915/selftests/i915_perf.c:26 alloc_empty_config() warn: returning -1 instead of -ENOMEM is sloppy
drivers/gpu/drm/i915/selftests/i915_perf.c:43 alloc_empty_config() warn: inconsistent returns 'perf->metrics_lock'.

# https://github.com/0day-ci/linux/commit/9da4da9daea4fec31c06906294a6e64e9bd19783
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 9da4da9daea4fec31c06906294a6e64e9bd19783
vim +26 drivers/gpu/drm/i915/selftests/i915_perf.c

9da4da9daea4fe Lionel Landwerlin 2020-03-06  19  static int
9da4da9daea4fe Lionel Landwerlin 2020-03-06  20  alloc_empty_config(struct i915_perf *perf)
9da4da9daea4fe Lionel Landwerlin 2020-03-06  21  {
9da4da9daea4fe Lionel Landwerlin 2020-03-06  22  	struct i915_oa_config *oa_config;
9da4da9daea4fe Lionel Landwerlin 2020-03-06  23  
9da4da9daea4fe Lionel Landwerlin 2020-03-06  24  	oa_config = kzalloc(sizeof(*oa_config), GFP_KERNEL);
9da4da9daea4fe Lionel Landwerlin 2020-03-06  25  	if (!oa_config)
9da4da9daea4fe Lionel Landwerlin 2020-03-06 @26  		return -1;

return -ENOMEM

9da4da9daea4fe Lionel Landwerlin 2020-03-06  27  
9da4da9daea4fe Lionel Landwerlin 2020-03-06  28  	oa_config->perf = perf;
9da4da9daea4fe Lionel Landwerlin 2020-03-06  29  	kref_init(&oa_config->ref);
9da4da9daea4fe Lionel Landwerlin 2020-03-06  30  
9da4da9daea4fe Lionel Landwerlin 2020-03-06  31  	strlcpy(oa_config->uuid, TEST_OA_CONFIG_UUID, sizeof(oa_config->uuid));
9da4da9daea4fe Lionel Landwerlin 2020-03-06  32  
9da4da9daea4fe Lionel Landwerlin 2020-03-06  33  	mutex_lock(&perf->metrics_lock);
9da4da9daea4fe Lionel Landwerlin 2020-03-06  34  
9da4da9daea4fe Lionel Landwerlin 2020-03-06  35  	oa_config->id = idr_alloc(&perf->metrics_idr, oa_config, 2, 0, GFP_KERNEL);
9da4da9daea4fe Lionel Landwerlin 2020-03-06  36  	if (oa_config->id < 0)  {
9da4da9daea4fe Lionel Landwerlin 2020-03-06  37  		i915_oa_config_put(oa_config);

unlock

9da4da9daea4fe Lionel Landwerlin 2020-03-06  38  		return -1;

return oa_config->id;

9da4da9daea4fe Lionel Landwerlin 2020-03-06  39  	}
9da4da9daea4fe Lionel Landwerlin 2020-03-06  40  
9da4da9daea4fe Lionel Landwerlin 2020-03-06  41  	mutex_unlock(&perf->metrics_lock);
9da4da9daea4fe Lionel Landwerlin 2020-03-06  42  
9da4da9daea4fe Lionel Landwerlin 2020-03-06 @43  	return 0;
9da4da9daea4fe Lionel Landwerlin 2020-03-06  44  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


More information about the Intel-gfx mailing list