Re: [PATCH 2/2] Add Intel LGM soc DMA support.

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

 



Hi Amireddy,

url:    https://github.com/0day-ci/linux/commits/Amireddy-Mallikarjuna-reddy/Add-Intel-LGM-soc-DMA-support/20200610-202116
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: i386-randconfig-m021-20200621 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
drivers/dma/lgm/lgm-dma.c:1306 ldma_cfg_init() error: uninitialized symbol 'ret'.

# https://github.com/0day-ci/linux/commit/23493bf02c8f7255c8ff22b02f42f0adccb8e8ad
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 23493bf02c8f7255c8ff22b02f42f0adccb8e8ad
vim +/ret +1306 drivers/dma/lgm/lgm-dma.c

23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1198  static int ldma_cfg_init(struct ldma_dev *d)
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1199  {
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1200  	struct fwnode_handle *fwnode = dev_fwnode(d->dev);
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1201  	struct fwnode_handle *fw_chans, *fw_chan;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1202  	struct fwnode_handle *fw_ports, *fw_port;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1203  	struct ldma_chan *c;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1204  	struct ldma_port *p;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1205  	u32 txendi, rxendi;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1206  	u32 prop, val;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1207  	int ret, i;
                                                                ^^^^^^^

23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1208  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1209  	if (fwnode_property_read_bool(fwnode, "intel,dma-chan-fc"))
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1210  		d->flags |= DMA_CHAN_FLOW_CTL;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1211  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1212  	if (fwnode_property_read_bool(fwnode, "intel,dma-desc-fod"))
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1213  		d->flags |= DMA_DESC_FTOD;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1214  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1215  	if (fwnode_property_read_bool(fwnode, "intel,dma-desc-in-sram"))
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1216  		d->flags |= DMA_DESC_IN_SRAM;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1217  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1218  	if (fwnode_property_read_bool(fwnode, "intel,dma-byte-en"))
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1219  		d->flags |= DMA_EN_BYTE_EN;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1220  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1221  	if (fwnode_property_read_bool(fwnode, "intel,dma-dfetch-ack"))
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1222  		d->flags |= DMA_VLD_FETCH_ACK;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1223  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1224  	if (fwnode_property_read_bool(fwnode, "intel,dma-dburst-wr"))
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1225  		d->flags |= DMA_DBURST_WR;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1226  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1227  	if (fwnode_property_read_bool(fwnode, "intel,dma-drb"))
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1228  		d->flags |= DMA_DFT_DRB;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1229  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1230  	if (fwnode_property_read_u32(fwnode, "intel,dma-polling-cnt",
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1231  				     &d->pollcnt))
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1232  		d->pollcnt = DMA_DFT_POLL_CNT;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1233  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1234  	if (!fwnode_property_read_u32(fwnode, "intel,dma-orrc", &val)) {
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1235  		if (val > DMA_ORRC_MAX_CNT)
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1236  			return -EINVAL;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1237  		d->orrc = val;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1238  	}
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1239  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1240  	if (d->ver > DMA_VER22) {
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1241  		if (fwnode_property_read_u32(fwnode, "intel,dma-txendi",
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1242  					     &txendi))
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1243  			txendi = DMA_DFT_ENDIAN;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1244  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1245  		if (fwnode_property_read_u32(fwnode, "intel,dma-rxendi",
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1246  					     &rxendi))
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1247  			rxendi = DMA_DFT_ENDIAN;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1248  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1249  		if (!d->port_nrs)
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1250  			return -EINVAL;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1251  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1252  		for (i = 0; i < d->port_nrs; i++) {
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1253  			p = &d->ports[i];
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1254  			p->rxendi = rxendi;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1255  			p->txendi = txendi;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1256  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1257  			if (!fwnode_property_read_u32(fwnode, "intel,dma-burst",
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1258  						      &prop)) {
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1259  				p->rxbl = prop;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1260  				p->txbl = prop;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1261  			} else {
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1262  				p->rxbl = DMA_DFT_BURST;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1263  				p->txbl = DMA_DFT_BURST;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1264  			}
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1265  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1266  			p->pkt_drop = DMA_PKT_DROP_DIS;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1267  			p->flush_memcpy = 0;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1268  		}
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1269  	}
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1270  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1271  	/* Port specific, required for dma0 */
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1272  	fw_ports = fwnode_get_named_child_node(fwnode, "dma,ports");
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1273  	if (!fw_ports && d->ver == DMA_VER22) {
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1274  		dev_err(d->dev, "Failed to get ports settings\n");
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1275  		return -ENODEV;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1276  	}
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1277  	if (fw_ports) {
                                                                     ^^^^^^^
"ret" is not initialized if fw_ports is false.

23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1278  		fwnode_for_each_child_node(fw_ports, fw_port) {
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1279  			ret = dma_parse_port_dt(fw_port, d);
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1280  			if (ret) {
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1281  				fwnode_handle_put(fw_port);
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1282  				fwnode_handle_put(fw_ports);
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1283  				return -EINVAL;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1284  			}
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1285  		}
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1286  		fwnode_handle_put(fw_ports);
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1287  	}
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1288  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1289  	d->chans = devm_kcalloc(d->dev, d->chan_nrs, sizeof(*c), GFP_KERNEL);
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1290  	if (!d->chans)
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1291  		return -ENOMEM;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1292  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1293  	/* Channel based configuration if available, optional */
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1294  	fw_chans = fwnode_get_named_child_node(fwnode, "dma,channels");
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1295  	if (fw_chans) {
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1296  		fwnode_for_each_child_node(fw_chans, fw_chan) {
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1297  			if (dma_parse_chan_dt(fw_chan, d)) {
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1298  				fwnode_handle_put(fw_chan);
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1299  				fwnode_handle_put(fw_chans);
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1300  				return -EINVAL;
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1301  			}
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1302  		}
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1303  		fwnode_handle_put(fw_chans);
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1304  	}
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1305  
23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10 @1306  	return ret;
                                                                ^^^^^^^^^^
It's more readable to return a literal.  "return 0;".

23493bf02c8f72 Amireddy Mallikarjuna reddy 2020-06-10  1307  }

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux