Message ID | 20170218080614.1828-1-christophe.jaillet@wanadoo.fr (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Christophe, [auto build test ERROR on v4.9-rc8] [also build test ERROR on next-20170217] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Christophe-JAILLET/soc-ti-knav_dma-Fix-some-error-handling/20170218-164533 config: arm-allmodconfig (attached as .config) compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705 reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=arm All errors (new ones prefixed by >>): drivers/soc/ti/knav_dma.c: In function 'dma_init': >> drivers/soc/ti/knav_dma.c:675:13: error: 'ma' undeclared (first use in this function) if (IS_ERR(ma->reg_rx_flow)) ^~ drivers/soc/ti/knav_dma.c:675:13: note: each undeclared identifier is reported only once for each function it appears in vim +/ma +675 drivers/soc/ti/knav_dma.c 669 dma->reg_tx_sched = pktdma_get_regs(dma, node, 3, &size); 670 if (IS_ERR(dma->reg_tx_sched)) 671 return -ENODEV; 672 673 max_tx_sched = size / sizeof(struct reg_tx_sched); 674 dma->reg_rx_flow = pktdma_get_regs(dma, node, 4, &size); > 675 if (IS_ERR(ma->reg_rx_flow)) 676 return -ENODEV; 677 678 max_rx_flow = size / sizeof(struct reg_rx_flow); --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c index ecebe2eecc3a..3272b379bfcd 100644 --- a/drivers/soc/ti/knav_dma.c +++ b/drivers/soc/ti/knav_dma.c @@ -649,7 +649,7 @@ static int dma_init(struct device_node *cloud, struct device_node *dma_node) } dma->reg_global = pktdma_get_regs(dma, node, 0, &size); - if (!dma->reg_global) + if (IS_ERR(dma->reg_global)) return -ENODEV; if (size < sizeof(struct reg_global)) { dev_err(kdev->dev, "bad size %pa for global regs\n", &size); @@ -657,22 +657,22 @@ static int dma_init(struct device_node *cloud, struct device_node *dma_node) } dma->reg_tx_chan = pktdma_get_regs(dma, node, 1, &size); - if (!dma->reg_tx_chan) + if (IS_ERR(dma->reg_tx_chan)) return -ENODEV; max_tx_chan = size / sizeof(struct reg_chan); dma->reg_rx_chan = pktdma_get_regs(dma, node, 2, &size); - if (!dma->reg_rx_chan) + if (IS_ERR(dma->reg_rx_chan)) return -ENODEV; max_rx_chan = size / sizeof(struct reg_chan); dma->reg_tx_sched = pktdma_get_regs(dma, node, 3, &size); - if (!dma->reg_tx_sched) + if (IS_ERR(dma->reg_tx_sched)) return -ENODEV; max_tx_sched = size / sizeof(struct reg_tx_sched); dma->reg_rx_flow = pktdma_get_regs(dma, node, 4, &size); - if (!dma->reg_rx_flow) + if (IS_ERR(ma->reg_rx_flow)) return -ENODEV; max_rx_flow = size / sizeof(struct reg_rx_flow);
'pktdma_get_regs()' never returns NULL. It returns an error pointer or a valid pointer. So test its return value with IS_ERR. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> --- After checking with IS_ERR, it could be better to propagate the error code instead of returning -ENODEV uncondionnaly --- drivers/soc/ti/knav_dma.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)