Re: [PATCH] dmaengine: sh: usb-dmac: handle pm_runtime_get_sync failure

From: kernel test robot
Date: Thu Jun 04 2020 - 20:44:50 EST


Hi Navid,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on slave-dma/next]
[also build test WARNING on linus/master v5.7 next-20200604]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Navid-Emamdoost/dmaengine-sh-usb-dmac-handle-pm_runtime_get_sync-failure/20200605-043604
base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/slave-dma.git next
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project ac47588bc4ff5927a01ed6fcd269ce86aba52a7c)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

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

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> drivers/dma/sh/usb-dmac.c:858:1: warning: unused label 'error_pm' [-Wunused-label]
error_pm:
^~~~~~~~~
1 warning generated.

vim +/error_pm +858 drivers/dma/sh/usb-dmac.c

0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 763
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 764 static int usb_dmac_probe(struct platform_device *pdev)
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 765 {
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 766 const enum dma_slave_buswidth widths = USB_DMAC_SLAVE_BUSWIDTH;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 767 struct dma_device *engine;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 768 struct usb_dmac *dmac;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 769 struct resource *mem;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 770 unsigned int i;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 771 int ret;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 772
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 773 dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac), GFP_KERNEL);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 774 if (!dmac)
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 775 return -ENOMEM;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 776
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 777 dmac->dev = &pdev->dev;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 778 platform_set_drvdata(pdev, dmac);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 779
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 780 ret = usb_dmac_parse_of(&pdev->dev, dmac);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 781 if (ret < 0)
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 782 return ret;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 783
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 784 dmac->channels = devm_kcalloc(&pdev->dev, dmac->n_channels,
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 785 sizeof(*dmac->channels), GFP_KERNEL);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 786 if (!dmac->channels)
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 787 return -ENOMEM;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 788
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 789 /* Request resources. */
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 790 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 791 dmac->iomem = devm_ioremap_resource(&pdev->dev, mem);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 792 if (IS_ERR(dmac->iomem))
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 793 return PTR_ERR(dmac->iomem);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 794
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 795 /* Enable runtime PM and initialize the device. */
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 796 pm_runtime_enable(&pdev->dev);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 797 ret = pm_runtime_get_sync(&pdev->dev);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 798 if (ret < 0) {
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 799 dev_err(&pdev->dev, "runtime PM get sync failed (%d)\n", ret);
7a0d517ffdb0ce Navid Emamdoost 2020-06-04 800 goto error_pm_get;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 801 }
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 802
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 803 ret = usb_dmac_init(dmac);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 804
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 805 if (ret) {
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 806 dev_err(&pdev->dev, "failed to reset device\n");
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 807 goto error;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 808 }
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 809
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 810 /* Initialize the channels. */
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 811 INIT_LIST_HEAD(&dmac->engine.channels);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 812
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 813 for (i = 0; i < dmac->n_channels; ++i) {
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 814 ret = usb_dmac_chan_probe(dmac, &dmac->channels[i], i);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 815 if (ret < 0)
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 816 goto error;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 817 }
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 818
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 819 /* Register the DMAC as a DMA provider for DT. */
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 820 ret = of_dma_controller_register(pdev->dev.of_node, usb_dmac_of_xlate,
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 821 NULL);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 822 if (ret < 0)
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 823 goto error;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 824
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 825 /*
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 826 * Register the DMA engine device.
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 827 *
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 828 * Default transfer size of 32 bytes requires 32-byte alignment.
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 829 */
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 830 engine = &dmac->engine;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 831 dma_cap_set(DMA_SLAVE, engine->cap_mask);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 832
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 833 engine->dev = &pdev->dev;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 834
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 835 engine->src_addr_widths = widths;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 836 engine->dst_addr_widths = widths;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 837 engine->directions = BIT(DMA_MEM_TO_DEV) | BIT(DMA_DEV_TO_MEM);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 838 engine->residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 839
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 840 engine->device_alloc_chan_resources = usb_dmac_alloc_chan_resources;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 841 engine->device_free_chan_resources = usb_dmac_free_chan_resources;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 842 engine->device_prep_slave_sg = usb_dmac_prep_slave_sg;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 843 engine->device_terminate_all = usb_dmac_chan_terminate_all;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 844 engine->device_tx_status = usb_dmac_tx_status;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 845 engine->device_issue_pending = usb_dmac_issue_pending;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 846
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 847 ret = dma_async_device_register(engine);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 848 if (ret < 0)
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 849 goto error;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 850
36fa4a530b7798 Geert Uytterhoeven 2015-10-25 851 pm_runtime_put(&pdev->dev);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 852 return 0;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 853
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 854 error:
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 855 of_dma_controller_free(pdev->dev.of_node);
7a0d517ffdb0ce Navid Emamdoost 2020-06-04 856 error_pm_get:
36fa4a530b7798 Geert Uytterhoeven 2015-10-25 857 pm_runtime_put(&pdev->dev);
bf55555baaf80c Geert Uytterhoeven 2015-10-25 @858 error_pm:
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 859 pm_runtime_disable(&pdev->dev);
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 860 return ret;
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 861 }
0c1c8ff32fa29e Yoshihiro Shimoda 2015-04-01 862

:::::: The code at line 858 was first introduced by commit
:::::: bf55555baaf80cdf2cc4176fee02545a07a8ff4a dmaengine: sh: usb-dmac: Fix pm_runtime_{enable,disable}() imbalance

:::::: TO: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
:::::: CC: Vinod Koul <vinod.koul@xxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip