[staging:staging-testing 104/105] drivers/staging//fsl-mc/bus/fsl-mc-bus.c:663:9: warning: 'error' may be used uninitialized in this function

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-testing
head:   f3145c023966af8e207b6b3cdb6187c35e7f9e95
commit: 657582b9e91728b91307ef6ba6f069ed0b67c7b4 [104/105] staging: fsl-mc: add support for device type
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 657582b9e91728b91307ef6ba6f069ed0b67c7b4
        # save the attached .config to linux build tree
        make.cross ARCH=powerpc 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/staging//fsl-mc/bus/fsl-mc-bus.c: In function 'fsl_mc_device_add':
>> drivers/staging//fsl-mc/bus/fsl-mc-bus.c:663:9: warning: 'error' may be used uninitialized in this function [-Wmaybe-uninitialized]
     return error;
            ^~~~~

vim +/error +663 drivers/staging//fsl-mc/bus/fsl-mc-bus.c

95b3523b7 drivers/staging/fsl-mc/bus/fsl-mc-bus.c Laurentiu Tudor  2017-02-07  528  
fde867d30 drivers/staging/fsl-mc/bus/mc-bus.c     Stuart Yoder     2016-06-22  529  /**
58caaac1f drivers/staging/fsl-mc/bus/fsl-mc-bus.c Stuart Yoder     2016-10-26  530   * Add a newly discovered fsl-mc device to be visible in Linux
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  531   */
0cf9f5096 drivers/staging/fsl-mc/bus/fsl-mc-bus.c Laurentiu Tudor  2017-06-27  532  int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  533  		      struct fsl_mc_io *mc_io,
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  534  		      struct device *parent_dev,
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  535  		      struct fsl_mc_device **new_mc_dev)
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  536  {
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  537  	int error;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  538  	struct fsl_mc_device *mc_dev = NULL;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  539  	struct fsl_mc_bus *mc_bus = NULL;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  540  	struct fsl_mc_device *parent_mc_dev;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  541  
df5e9b5fb drivers/staging/fsl-mc/bus/mc-bus.c     Nipun Gupta      2016-06-29  542  	if (dev_is_fsl_mc(parent_dev))
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  543  		parent_mc_dev = to_fsl_mc_device(parent_dev);
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  544  	else
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  545  		parent_mc_dev = NULL;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  546  
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  547  	if (strcmp(obj_desc->type, "dprc") == 0) {
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  548  		/*
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  549  		 * Allocate an MC bus device object:
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  550  		 */
dc341c4ec drivers/staging/fsl-mc/bus/fsl-mc-bus.c Laurentiu Tudor  2017-02-07  551  		mc_bus = kzalloc(sizeof(*mc_bus), GFP_KERNEL);
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  552  		if (!mc_bus)
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  553  			return -ENOMEM;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  554  
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  555  		mc_dev = &mc_bus->mc_dev;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  556  	} else {
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  557  		/*
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  558  		 * Allocate a regular fsl_mc_device object:
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  559  		 */
9b65332e0 drivers/staging/fsl-mc/bus/fsl-mc-bus.c Laurentiu Tudor  2017-02-07  560  		mc_dev = kzalloc(sizeof(*mc_dev), GFP_KERNEL);
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  561  		if (!mc_dev)
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  562  			return -ENOMEM;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  563  	}
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  564  
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  565  	mc_dev->obj_desc = *obj_desc;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  566  	mc_dev->mc_io = mc_io;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  567  	device_initialize(&mc_dev->dev);
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  568  	mc_dev->dev.parent = parent_dev;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  569  	mc_dev->dev.bus = &fsl_mc_bus_type;
95b3523b7 drivers/staging/fsl-mc/bus/fsl-mc-bus.c Laurentiu Tudor  2017-02-07  570  	mc_dev->dev.release = fsl_mc_device_release;
657582b9e drivers/staging/fsl-mc/bus/fsl-mc-bus.c Laurentiu Tudor  2017-11-17  571  	mc_dev->dev.type = fsl_mc_get_device_type(obj_desc->type);
657582b9e drivers/staging/fsl-mc/bus/fsl-mc-bus.c Laurentiu Tudor  2017-11-17  572  	if (!mc_dev->dev.type) {
657582b9e drivers/staging/fsl-mc/bus/fsl-mc-bus.c Laurentiu Tudor  2017-11-17  573  		dev_err(parent_dev, "unknown device type %s\n", obj_desc->type);
657582b9e drivers/staging/fsl-mc/bus/fsl-mc-bus.c Laurentiu Tudor  2017-11-17  574  		goto error_cleanup_dev;
657582b9e drivers/staging/fsl-mc/bus/fsl-mc-bus.c Laurentiu Tudor  2017-11-17  575  	}
77371fbd4 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-27  576  	dev_set_name(&mc_dev->dev, "%s.%d", obj_desc->type, obj_desc->id);
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  577  
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  578  	if (strcmp(obj_desc->type, "dprc") == 0) {
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  579  		struct fsl_mc_io *mc_io2;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  580  
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  581  		mc_dev->flags |= FSL_MC_IS_DPRC;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  582  
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  583  		/*
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  584  		 * To get the DPRC's ICID, we need to open the DPRC
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  585  		 * in get_dprc_icid(). For child DPRCs, we do so using the
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  586  		 * parent DPRC's MC portal instead of the child DPRC's MC
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  587  		 * portal, in case the child DPRC is already opened with
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  588  		 * its own portal (e.g., the DPRC used by AIOP).
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  589  		 *
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  590  		 * NOTE: There cannot be more than one active open for a
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  591  		 * given MC object, using the same MC portal.
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  592  		 */
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  593  		if (parent_mc_dev) {
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  594  			/*
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  595  			 * device being added is a child DPRC device
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  596  			 */
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  597  			mc_io2 = parent_mc_dev->mc_io;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  598  		} else {
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  599  			/*
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  600  			 * device being added is the root DPRC device
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  601  			 */
7d961e7e2 drivers/staging/fsl-mc/bus/fsl-mc-bus.c Laurentiu Tudor  2017-11-17  602  			if (!mc_io) {
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  603  				error = -EINVAL;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  604  				goto error_cleanup_dev;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  605  			}
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  606  
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  607  			mc_io2 = mc_io;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  608  		}
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  609  
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  610  		error = get_dprc_icid(mc_io2, obj_desc->id, &mc_dev->icid);
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  611  		if (error < 0)
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  612  			goto error_cleanup_dev;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  613  	} else {
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  614  		/*
58caaac1f drivers/staging/fsl-mc/bus/fsl-mc-bus.c Stuart Yoder     2016-10-26  615  		 * A non-DPRC object has to be a child of a DPRC, use the
58caaac1f drivers/staging/fsl-mc/bus/fsl-mc-bus.c Stuart Yoder     2016-10-26  616  		 * parent's ICID and interrupt domain.
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  617  		 */
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  618  		mc_dev->icid = parent_mc_dev->icid;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  619  		mc_dev->dma_mask = FSL_MC_DEFAULT_DMA_MASK;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  620  		mc_dev->dev.dma_mask = &mc_dev->dma_mask;
660a24bf6 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2016-01-06  621  		dev_set_msi_domain(&mc_dev->dev,
660a24bf6 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2016-01-06  622  				   dev_get_msi_domain(&parent_mc_dev->dev));
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  623  	}
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  624  
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  625  	/*
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  626  	 * Get MMIO regions for the device from the MC:
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  627  	 *
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  628  	 * NOTE: the root DPRC is a special case as its MMIO region is
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  629  	 * obtained from the device tree
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  630  	 */
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  631  	if (parent_mc_dev && obj_desc->region_count != 0) {
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  632  		error = fsl_mc_device_get_mmio_regions(mc_dev,
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  633  						       parent_mc_dev);
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  634  		if (error < 0)
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  635  			goto error_cleanup_dev;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  636  	}
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  637  
0f90f25b8 drivers/staging/fsl-mc/bus/mc-bus.c     Stuart Yoder     2016-04-11  638  	/* Objects are coherent, unless 'no shareability' flag set. */
0cf9f5096 drivers/staging/fsl-mc/bus/fsl-mc-bus.c Laurentiu Tudor  2017-06-27  639  	if (!(obj_desc->flags & FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY))
0f90f25b8 drivers/staging/fsl-mc/bus/mc-bus.c     Stuart Yoder     2016-04-11  640  		arch_setup_dma_ops(&mc_dev->dev, 0, 0, NULL, true);
0f90f25b8 drivers/staging/fsl-mc/bus/mc-bus.c     Stuart Yoder     2016-04-11  641  
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  642  	/*
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  643  	 * The device-specific probe callback will get invoked by device_add()
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  644  	 */
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  645  	error = device_add(&mc_dev->dev);
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  646  	if (error < 0) {
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  647  		dev_err(parent_dev,
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  648  			"device_add() failed for device %s: %d\n",
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  649  			dev_name(&mc_dev->dev), error);
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  650  		goto error_cleanup_dev;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  651  	}
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  652  
e3494af5c drivers/staging/fsl-mc/bus/fsl-mc-bus.c Stuart Yoder     2016-10-26  653  	dev_dbg(parent_dev, "added %s\n", dev_name(&mc_dev->dev));
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  654  
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  655  	*new_mc_dev = mc_dev;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  656  	return 0;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  657  
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  658  error_cleanup_dev:
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  659  	kfree(mc_dev->regions);
dc341c4ec drivers/staging/fsl-mc/bus/fsl-mc-bus.c Laurentiu Tudor  2017-02-07  660  	kfree(mc_bus);
9b65332e0 drivers/staging/fsl-mc/bus/fsl-mc-bus.c Laurentiu Tudor  2017-02-07  661  	kfree(mc_dev);
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  662  
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05 @663  	return error;
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  664  }
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  665  EXPORT_SYMBOL_GPL(fsl_mc_device_add);
bbf9d17d9 drivers/staging/fsl-mc/bus/mc-bus.c     J. German Rivera 2015-03-05  666  

:::::: The code at line 663 was first introduced by commit
:::::: bbf9d17d987544bd784fa0a6b99d756b0492e715 staging: fsl-mc: Freescale Management Complex (fsl-mc) bus driver

:::::: TO: J. German Rivera <German.Rivera@xxxxxxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux