[drm-misc:drm-misc-next 2/6] drivers/gpu/drm/drm_managed.c:200:22-24: WARNING !A || A && B is equivalent to !A || B

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
head:   041261ac4c365e03b07427569d6735f8adfd21c8
commit: 42d6196f6a948aaecfedf72326925dcbd054f9db [2/6] drm/managed: Add drmm_release_action
config: x86_64-randconfig-103-20240201 (https://download.01.org/0day-ci/archive/20240202/202402020855.4Fsjr97a-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402020855.4Fsjr97a-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/drm_managed.c:200:22-24: WARNING !A || A && B is equivalent to !A || B

vim +200 drivers/gpu/drm/drm_managed.c

   178	
   179	/**
   180	 * drmm_release_action - release a managed action from a &drm_device
   181	 * @dev: DRM device
   182	 * @action: function which would be called when @dev is released
   183	 * @data: opaque pointer, passed to @action
   184	 *
   185	 * This function calls the @action previously added by drmm_add_action()
   186	 * immediately.
   187	 * The @action is removed from the list of cleanup actions for @dev,
   188	 * which means that it won't be called in the final drm_dev_put().
   189	 */
   190	void drmm_release_action(struct drm_device *dev,
   191				 drmres_release_t action,
   192				 void *data)
   193	{
   194		struct drmres *dr_match = NULL, *dr;
   195		unsigned long flags;
   196	
   197		spin_lock_irqsave(&dev->managed.lock, flags);
   198		list_for_each_entry_reverse(dr, &dev->managed.resources, node.entry) {
   199			if (dr->node.release == action) {
 > 200				if (!data || (data && *(void **)dr->data == data)) {
   201					dr_match = dr;
   202					del_dr(dev, dr_match);
   203					break;
   204				}
   205			}
   206		}
   207		spin_unlock_irqrestore(&dev->managed.lock, flags);
   208	
   209		if (WARN_ON(!dr_match))
   210			return;
   211	
   212		action(dev, data);
   213	
   214		free_dr(dr_match);
   215	}
   216	EXPORT_SYMBOL(drmm_release_action);
   217	

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



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux