oe-kbuild-all.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 9168/10491] drivers/gpu/drm/drm_plane.c:212:24: sparse: sparse: Using plain integer as NULL pointer
@ 2025-05-12 19:38 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-05-12 19:38 UTC (permalink / raw)
  To: Arun R Murthy
  Cc: oe-kbuild-all, Suraj Kandpal, Chaitanya Kumar Borah,
	Ville Syrjälä

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   edef457004774e598fc4c1b7d1d4f0bcd9d0bb30
commit: 0d6dcd741c266389bbf0a8758f537b3a171ac32a [9168/10491] drm/plane: modify create_in_formats to acommodate async
config: hexagon-randconfig-r122-20250512 (https://download.01.org/0day-ci/archive/20250513/202505130314.2p06umZj-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce: (https://download.01.org/0day-ci/archive/20250513/202505130314.2p06umZj-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505130314.2p06umZj-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/drm_plane.c:212:24: sparse: sparse: Using plain integer as NULL pointer

vim +212 drivers/gpu/drm/drm_plane.c

db1689aa61bd1e Ben Widawsky  2017-07-23  195  
0d6dcd741c2663 Arun R Murthy 2025-04-07  196  static struct drm_property_blob *create_in_format_blob(struct drm_device *dev,
0d6dcd741c2663 Arun R Murthy 2025-04-07  197  						       struct drm_plane *plane,
0d6dcd741c2663 Arun R Murthy 2025-04-07  198  						       bool (*format_mod_supported)
0d6dcd741c2663 Arun R Murthy 2025-04-07  199  						       (struct drm_plane *plane,
0d6dcd741c2663 Arun R Murthy 2025-04-07  200  							u32 format,
0d6dcd741c2663 Arun R Murthy 2025-04-07  201  							u64 modifier))
db1689aa61bd1e Ben Widawsky  2017-07-23  202  {
db1689aa61bd1e Ben Widawsky  2017-07-23  203  	struct drm_property_blob *blob;
db1689aa61bd1e Ben Widawsky  2017-07-23  204  	struct drm_format_modifier *mod;
db1689aa61bd1e Ben Widawsky  2017-07-23  205  	size_t blob_size, formats_size, modifiers_size;
db1689aa61bd1e Ben Widawsky  2017-07-23  206  	struct drm_format_modifier_blob *blob_data;
db1689aa61bd1e Ben Widawsky  2017-07-23  207  	unsigned int i, j;
db1689aa61bd1e Ben Widawsky  2017-07-23  208  
db1689aa61bd1e Ben Widawsky  2017-07-23  209  	formats_size = sizeof(__u32) * plane->format_count;
db1689aa61bd1e Ben Widawsky  2017-07-23  210  	if (WARN_ON(!formats_size)) {
db1689aa61bd1e Ben Widawsky  2017-07-23  211  		/* 0 formats are never expected */
db1689aa61bd1e Ben Widawsky  2017-07-23 @212  		return 0;
db1689aa61bd1e Ben Widawsky  2017-07-23  213  	}
db1689aa61bd1e Ben Widawsky  2017-07-23  214  
db1689aa61bd1e Ben Widawsky  2017-07-23  215  	modifiers_size =
db1689aa61bd1e Ben Widawsky  2017-07-23  216  		sizeof(struct drm_format_modifier) * plane->modifier_count;
db1689aa61bd1e Ben Widawsky  2017-07-23  217  
db1689aa61bd1e Ben Widawsky  2017-07-23  218  	blob_size = sizeof(struct drm_format_modifier_blob);
db1689aa61bd1e Ben Widawsky  2017-07-23  219  	/* Modifiers offset is a pointer to a struct with a 64 bit field so it
db1689aa61bd1e Ben Widawsky  2017-07-23  220  	 * should be naturally aligned to 8B.
db1689aa61bd1e Ben Widawsky  2017-07-23  221  	 */
db1689aa61bd1e Ben Widawsky  2017-07-23  222  	BUILD_BUG_ON(sizeof(struct drm_format_modifier_blob) % 8);
db1689aa61bd1e Ben Widawsky  2017-07-23  223  	blob_size += ALIGN(formats_size, 8);
db1689aa61bd1e Ben Widawsky  2017-07-23  224  	blob_size += modifiers_size;
db1689aa61bd1e Ben Widawsky  2017-07-23  225  
db1689aa61bd1e Ben Widawsky  2017-07-23  226  	blob = drm_property_create_blob(dev, blob_size, NULL);
db1689aa61bd1e Ben Widawsky  2017-07-23  227  	if (IS_ERR(blob))
0d6dcd741c2663 Arun R Murthy 2025-04-07  228  		return NULL;
db1689aa61bd1e Ben Widawsky  2017-07-23  229  
11b83e3fbc4196 Ville Syrjälä 2018-02-23  230  	blob_data = blob->data;
db1689aa61bd1e Ben Widawsky  2017-07-23  231  	blob_data->version = FORMAT_BLOB_CURRENT;
db1689aa61bd1e Ben Widawsky  2017-07-23  232  	blob_data->count_formats = plane->format_count;
db1689aa61bd1e Ben Widawsky  2017-07-23  233  	blob_data->formats_offset = sizeof(struct drm_format_modifier_blob);
db1689aa61bd1e Ben Widawsky  2017-07-23  234  	blob_data->count_modifiers = plane->modifier_count;
db1689aa61bd1e Ben Widawsky  2017-07-23  235  
db1689aa61bd1e Ben Widawsky  2017-07-23  236  	blob_data->modifiers_offset =
db1689aa61bd1e Ben Widawsky  2017-07-23  237  		ALIGN(blob_data->formats_offset + formats_size, 8);
db1689aa61bd1e Ben Widawsky  2017-07-23  238  
db1689aa61bd1e Ben Widawsky  2017-07-23  239  	memcpy(formats_ptr(blob_data), plane->format_types, formats_size);
db1689aa61bd1e Ben Widawsky  2017-07-23  240  
db1689aa61bd1e Ben Widawsky  2017-07-23  241  	mod = modifiers_ptr(blob_data);
db1689aa61bd1e Ben Widawsky  2017-07-23  242  	for (i = 0; i < plane->modifier_count; i++) {
db1689aa61bd1e Ben Widawsky  2017-07-23  243  		for (j = 0; j < plane->format_count; j++) {
0d6dcd741c2663 Arun R Murthy 2025-04-07  244  			if (!format_mod_supported ||
0d6dcd741c2663 Arun R Murthy 2025-04-07  245  			    format_mod_supported(plane,
db1689aa61bd1e Ben Widawsky  2017-07-23  246  						 plane->format_types[j],
db1689aa61bd1e Ben Widawsky  2017-07-23  247  						 plane->modifiers[i])) {
aadd41485bb227 Dan Carpenter 2017-08-09  248  				mod->formats |= 1ULL << j;
db1689aa61bd1e Ben Widawsky  2017-07-23  249  			}
db1689aa61bd1e Ben Widawsky  2017-07-23  250  		}
db1689aa61bd1e Ben Widawsky  2017-07-23  251  
db1689aa61bd1e Ben Widawsky  2017-07-23  252  		mod->modifier = plane->modifiers[i];
db1689aa61bd1e Ben Widawsky  2017-07-23  253  		mod->offset = 0;
db1689aa61bd1e Ben Widawsky  2017-07-23  254  		mod->pad = 0;
db1689aa61bd1e Ben Widawsky  2017-07-23  255  		mod++;
db1689aa61bd1e Ben Widawsky  2017-07-23  256  	}
db1689aa61bd1e Ben Widawsky  2017-07-23  257  
0d6dcd741c2663 Arun R Murthy 2025-04-07  258  	return blob;
db1689aa61bd1e Ben Widawsky  2017-07-23  259  }
db1689aa61bd1e Ben Widawsky  2017-07-23  260  

:::::: The code at line 212 was first introduced by commit
:::::: db1689aa61bd1efb5ce9b896e7aa860a85b7f1b6 drm: Create a format/modifier blob

:::::: TO: Ben Widawsky <ben@bwidawsk.net>
:::::: CC: Daniel Stone <daniels@collabora.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-05-12 19:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-12 19:38 [linux-next:master 9168/10491] drivers/gpu/drm/drm_plane.c:212:24: sparse: sparse: Using plain integer as NULL pointer kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).