[staging:staging-testing 32/135] drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:1722:6: warning: Variable 'ret' is reassigned a value before the old one has been used.

Dan Carpenter dan.carpenter at oracle.com
Tue Jul 7 14:27:36 UTC 2020


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-testing
head:   14442181d20490945f341644bb8257e334b01447
commit: b18ee53ad297264a79cf4ea566663f20786b6455 [32/135] staging: bcm2835: Break MMAL support out from camera
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

cppcheck warnings: (new ones prefixed by >>)

>> drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:1722:6: warning: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment]
    ret = destroy_component(instance, component);
        ^
   drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:1720:7: note: Variable 'ret' is reassigned a value before the old one has been used.
     ret = disable_component(instance, component);
         ^
   drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:1722:6: note: Variable 'ret' is reassigned a value before the old one has been used.
    ret = destroy_component(instance, component);
        ^

vim +/ret +1722 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c

7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27  1711  int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance,
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27  1712  				  struct vchiq_mmal_component *component)
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27  1713  {
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27  1714  	int ret;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27  1715  
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27  1716  	if (mutex_lock_interruptible(&instance->vchiq_mutex))
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27  1717  		return -EINTR;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27  1718  
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27  1719  	if (component->enabled)
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27  1720  		ret = disable_component(instance, component);
                                                                                                                ^^^^^^
Not used.

7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27  1721  
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27 @1722  	ret = destroy_component(instance, component);
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27  1723  
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27  1724  	mutex_unlock(&instance->vchiq_mutex);
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27  1725  
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27  1726  	return ret;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c   Eric Anholt  2017-01-27  1727  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
_______________________________________________
devel mailing list
devel at linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


More information about the devel mailing list