Re: [PATCH v7 26/37] spi: tegra20-slink: Improve runtime PM usage
From: kernel test robot
Date: Fri Jul 02 2021 - 04:29:41 EST
Hi Dmitry,
I love your patch! Perhaps something to improve:
[auto build test WARNING on next-20210701]
[cannot apply to tegra/for-next robh/for-next tegra-drm/drm/tegra/for-next v5.13 v5.13-rc7 v5.13-rc6 v5.13]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Dmitry-Osipenko/NVIDIA-Tegra-power-management-patches-for-5-15/20210702-073048
base: fb0ca446157a86b75502c1636b0d81e642fe6bf1
config: x86_64-randconfig-b001-20210630 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9eb613b2de3163686b1a4bd1160f15ac56a4b083)
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
# https://github.com/0day-ci/linux/commit/eae252678e4ba361dc1513283e282268a7548af6
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Dmitry-Osipenko/NVIDIA-Tegra-power-management-patches-for-5-15/20210702-073048
git checkout eae252678e4ba361dc1513283e282268a7548af6
# 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 >>):
>> drivers/spi/spi-tegra20-slink.c:1076:6: warning: variable 'spi_irq' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (ret < 0)
^~~~~~~
drivers/spi/spi-tegra20-slink.c:1126:11: note: uninitialized use occurs here
free_irq(spi_irq, tspi);
^~~~~~~
drivers/spi/spi-tegra20-slink.c:1076:2: note: remove the 'if' if its condition is always false
if (ret < 0)
^~~~~~~~~~~~
drivers/spi/spi-tegra20-slink.c:1066:6: warning: variable 'spi_irq' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (IS_ERR(tspi->rst)) {
^~~~~~~~~~~~~~~~~
drivers/spi/spi-tegra20-slink.c:1126:11: note: uninitialized use occurs here
free_irq(spi_irq, tspi);
^~~~~~~
drivers/spi/spi-tegra20-slink.c:1066:2: note: remove the 'if' if its condition is always false
if (IS_ERR(tspi->rst)) {
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi-tegra20-slink.c:1007:18: note: initialize the variable 'spi_irq' to silence this warning
int ret, spi_irq;
^
= 0
2 warnings generated.
vim +1076 drivers/spi/spi-tegra20-slink.c
dc4dc36056392c Laxman Dewangan 2012-10-30 1001
fd4a319bc933ae Grant Likely 2012-12-07 1002 static int tegra_slink_probe(struct platform_device *pdev)
dc4dc36056392c Laxman Dewangan 2012-10-30 1003 {
dc4dc36056392c Laxman Dewangan 2012-10-30 1004 struct spi_master *master;
dc4dc36056392c Laxman Dewangan 2012-10-30 1005 struct tegra_slink_data *tspi;
dc4dc36056392c Laxman Dewangan 2012-10-30 1006 struct resource *r;
dc4dc36056392c Laxman Dewangan 2012-10-30 1007 int ret, spi_irq;
dc4dc36056392c Laxman Dewangan 2012-10-30 1008 const struct tegra_slink_chip_data *cdata = NULL;
dc4dc36056392c Laxman Dewangan 2012-10-30 1009 const struct of_device_id *match;
dc4dc36056392c Laxman Dewangan 2012-10-30 1010
c60fea02141167 Stephen Warren 2013-02-15 1011 match = of_match_device(tegra_slink_of_match, &pdev->dev);
dc4dc36056392c Laxman Dewangan 2012-10-30 1012 if (!match) {
dc4dc36056392c Laxman Dewangan 2012-10-30 1013 dev_err(&pdev->dev, "Error: No device match found\n");
dc4dc36056392c Laxman Dewangan 2012-10-30 1014 return -ENODEV;
dc4dc36056392c Laxman Dewangan 2012-10-30 1015 }
dc4dc36056392c Laxman Dewangan 2012-10-30 1016 cdata = match->data;
dc4dc36056392c Laxman Dewangan 2012-10-30 1017
dc4dc36056392c Laxman Dewangan 2012-10-30 1018 master = spi_alloc_master(&pdev->dev, sizeof(*tspi));
dc4dc36056392c Laxman Dewangan 2012-10-30 1019 if (!master) {
dc4dc36056392c Laxman Dewangan 2012-10-30 1020 dev_err(&pdev->dev, "master allocation failed\n");
dc4dc36056392c Laxman Dewangan 2012-10-30 1021 return -ENOMEM;
dc4dc36056392c Laxman Dewangan 2012-10-30 1022 }
dc4dc36056392c Laxman Dewangan 2012-10-30 1023
dc4dc36056392c Laxman Dewangan 2012-10-30 1024 /* the spi->mode bits understood by this driver: */
dc4dc36056392c Laxman Dewangan 2012-10-30 1025 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
dc4dc36056392c Laxman Dewangan 2012-10-30 1026 master->setup = tegra_slink_setup;
63fc184cde2d77 Mark Brown 2013-10-05 1027 master->prepare_message = tegra_slink_prepare_message;
63fc184cde2d77 Mark Brown 2013-10-05 1028 master->transfer_one = tegra_slink_transfer_one;
63fc184cde2d77 Mark Brown 2013-10-05 1029 master->unprepare_message = tegra_slink_unprepare_message;
ce74ac80d25bcb Mark Brown 2013-07-28 1030 master->auto_runtime_pm = true;
dc4dc36056392c Laxman Dewangan 2012-10-30 1031 master->num_chipselect = MAX_CHIP_SELECT;
dc4dc36056392c Laxman Dewangan 2012-10-30 1032
24b5a82cf5709a Jingoo Han 2013-05-23 1033 platform_set_drvdata(pdev, master);
dc4dc36056392c Laxman Dewangan 2012-10-30 1034 tspi = spi_master_get_devdata(master);
dc4dc36056392c Laxman Dewangan 2012-10-30 1035 tspi->master = master;
dc4dc36056392c Laxman Dewangan 2012-10-30 1036 tspi->dev = &pdev->dev;
dc4dc36056392c Laxman Dewangan 2012-10-30 1037 tspi->chip_data = cdata;
dc4dc36056392c Laxman Dewangan 2012-10-30 1038 spin_lock_init(&tspi->lock);
dc4dc36056392c Laxman Dewangan 2012-10-30 1039
3c604de496d756 Axel Lin 2014-02-10 1040 if (of_property_read_u32(tspi->dev->of_node, "spi-max-frequency",
3c604de496d756 Axel Lin 2014-02-10 1041 &master->max_speed_hz))
3c604de496d756 Axel Lin 2014-02-10 1042 master->max_speed_hz = 25000000; /* 25MHz */
c60fea02141167 Stephen Warren 2013-02-15 1043
dc4dc36056392c Laxman Dewangan 2012-10-30 1044 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
dc4dc36056392c Laxman Dewangan 2012-10-30 1045 if (!r) {
dc4dc36056392c Laxman Dewangan 2012-10-30 1046 dev_err(&pdev->dev, "No IO memory resource\n");
dc4dc36056392c Laxman Dewangan 2012-10-30 1047 ret = -ENODEV;
dc4dc36056392c Laxman Dewangan 2012-10-30 1048 goto exit_free_master;
dc4dc36056392c Laxman Dewangan 2012-10-30 1049 }
dc4dc36056392c Laxman Dewangan 2012-10-30 1050 tspi->phys = r->start;
b0ee5605234a24 Thierry Reding 2013-01-21 1051 tspi->base = devm_ioremap_resource(&pdev->dev, r);
b0ee5605234a24 Thierry Reding 2013-01-21 1052 if (IS_ERR(tspi->base)) {
b0ee5605234a24 Thierry Reding 2013-01-21 1053 ret = PTR_ERR(tspi->base);
dc4dc36056392c Laxman Dewangan 2012-10-30 1054 goto exit_free_master;
dc4dc36056392c Laxman Dewangan 2012-10-30 1055 }
dc4dc36056392c Laxman Dewangan 2012-10-30 1056
7001cab1dabc0b Marcel Ziswiler 2018-08-29 1057 /* disabled clock may cause interrupt storm upon request */
7001cab1dabc0b Marcel Ziswiler 2018-08-29 1058 tspi->clk = devm_clk_get(&pdev->dev, NULL);
7001cab1dabc0b Marcel Ziswiler 2018-08-29 1059 if (IS_ERR(tspi->clk)) {
7001cab1dabc0b Marcel Ziswiler 2018-08-29 1060 ret = PTR_ERR(tspi->clk);
7001cab1dabc0b Marcel Ziswiler 2018-08-29 1061 dev_err(&pdev->dev, "Can not get clock %d\n", ret);
7001cab1dabc0b Marcel Ziswiler 2018-08-29 1062 goto exit_free_master;
7001cab1dabc0b Marcel Ziswiler 2018-08-29 1063 }
dc4dc36056392c Laxman Dewangan 2012-10-30 1064
73b32756cec312 Philipp Zabel 2017-07-19 1065 tspi->rst = devm_reset_control_get_exclusive(&pdev->dev, "spi");
ff2251e3de37b0 Stephen Warren 2013-11-06 1066 if (IS_ERR(tspi->rst)) {
ff2251e3de37b0 Stephen Warren 2013-11-06 1067 dev_err(&pdev->dev, "can not get reset\n");
ff2251e3de37b0 Stephen Warren 2013-11-06 1068 ret = PTR_ERR(tspi->rst);
ff2251e3de37b0 Stephen Warren 2013-11-06 1069 goto exit_free_irq;
ff2251e3de37b0 Stephen Warren 2013-11-06 1070 }
ff2251e3de37b0 Stephen Warren 2013-11-06 1071
dc4dc36056392c Laxman Dewangan 2012-10-30 1072 tspi->max_buf_size = SLINK_FIFO_DEPTH << 2;
dc4dc36056392c Laxman Dewangan 2012-10-30 1073 tspi->dma_buf_size = DEFAULT_SPI_DMA_BUF_LEN;
dc4dc36056392c Laxman Dewangan 2012-10-30 1074
dc4dc36056392c Laxman Dewangan 2012-10-30 1075 ret = tegra_slink_init_dma_param(tspi, true);
a915d150f68d8f Stephen Warren 2013-11-11 @1076 if (ret < 0)
dc4dc36056392c Laxman Dewangan 2012-10-30 1077 goto exit_free_irq;
dc4dc36056392c Laxman Dewangan 2012-10-30 1078 ret = tegra_slink_init_dma_param(tspi, false);
a915d150f68d8f Stephen Warren 2013-11-11 1079 if (ret < 0)
dc4dc36056392c Laxman Dewangan 2012-10-30 1080 goto exit_rx_dma_free;
dc4dc36056392c Laxman Dewangan 2012-10-30 1081 tspi->max_buf_size = tspi->dma_buf_size;
dc4dc36056392c Laxman Dewangan 2012-10-30 1082 init_completion(&tspi->tx_dma_complete);
dc4dc36056392c Laxman Dewangan 2012-10-30 1083 init_completion(&tspi->rx_dma_complete);
dc4dc36056392c Laxman Dewangan 2012-10-30 1084
dc4dc36056392c Laxman Dewangan 2012-10-30 1085 init_completion(&tspi->xfer_completion);
dc4dc36056392c Laxman Dewangan 2012-10-30 1086
dc4dc36056392c Laxman Dewangan 2012-10-30 1087 pm_runtime_enable(&pdev->dev);
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1088 ret = pm_runtime_resume_and_get(&pdev->dev);
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1089 if (ret) {
dc4dc36056392c Laxman Dewangan 2012-10-30 1090 dev_err(&pdev->dev, "pm runtime get failed, e = %d\n", ret);
dc4dc36056392c Laxman Dewangan 2012-10-30 1091 goto exit_pm_disable;
dc4dc36056392c Laxman Dewangan 2012-10-30 1092 }
aceda401e84115 Jon Hunter 2021-06-08 1093
aceda401e84115 Jon Hunter 2021-06-08 1094 reset_control_assert(tspi->rst);
aceda401e84115 Jon Hunter 2021-06-08 1095 udelay(2);
aceda401e84115 Jon Hunter 2021-06-08 1096 reset_control_deassert(tspi->rst);
aceda401e84115 Jon Hunter 2021-06-08 1097
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1098 spi_irq = platform_get_irq(pdev, 0);
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1099 tspi->irq = spi_irq;
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1100 ret = request_threaded_irq(tspi->irq, tegra_slink_isr,
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1101 tegra_slink_isr_thread, IRQF_ONESHOT,
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1102 dev_name(&pdev->dev), tspi);
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1103 if (ret < 0) {
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1104 dev_err(&pdev->dev, "Failed to register ISR for IRQ %d\n",
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1105 tspi->irq);
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1106 goto exit_pm_put;
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1107 }
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1108
dc4dc36056392c Laxman Dewangan 2012-10-30 1109 tspi->def_command_reg = SLINK_M_S;
dc4dc36056392c Laxman Dewangan 2012-10-30 1110 tspi->def_command2_reg = SLINK_CS_ACTIVE_BETWEEN;
dc4dc36056392c Laxman Dewangan 2012-10-30 1111 tegra_slink_writel(tspi, tspi->def_command_reg, SLINK_COMMAND);
dc4dc36056392c Laxman Dewangan 2012-10-30 1112 tegra_slink_writel(tspi, tspi->def_command2_reg, SLINK_COMMAND2);
dc4dc36056392c Laxman Dewangan 2012-10-30 1113
dc4dc36056392c Laxman Dewangan 2012-10-30 1114 master->dev.of_node = pdev->dev.of_node;
716db5d64f5f9b Jingoo Han 2013-09-24 1115 ret = devm_spi_register_master(&pdev->dev, master);
dc4dc36056392c Laxman Dewangan 2012-10-30 1116 if (ret < 0) {
dc4dc36056392c Laxman Dewangan 2012-10-30 1117 dev_err(&pdev->dev, "can not register to master err %d\n", ret);
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1118 goto exit_free_irq;
dc4dc36056392c Laxman Dewangan 2012-10-30 1119 }
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1120
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1121 pm_runtime_put(&pdev->dev);
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1122
dc4dc36056392c Laxman Dewangan 2012-10-30 1123 return ret;
dc4dc36056392c Laxman Dewangan 2012-10-30 1124
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1125 exit_free_irq:
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1126 free_irq(spi_irq, tspi);
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1127 exit_pm_put:
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1128 pm_runtime_put(&pdev->dev);
dc4dc36056392c Laxman Dewangan 2012-10-30 1129 exit_pm_disable:
dc4dc36056392c Laxman Dewangan 2012-10-30 1130 pm_runtime_disable(&pdev->dev);
eae252678e4ba3 Dmitry Osipenko 2021-07-02 1131
dc4dc36056392c Laxman Dewangan 2012-10-30 1132 tegra_slink_deinit_dma_param(tspi, false);
dc4dc36056392c Laxman Dewangan 2012-10-30 1133 exit_rx_dma_free:
dc4dc36056392c Laxman Dewangan 2012-10-30 1134 tegra_slink_deinit_dma_param(tspi, true);
dc4dc36056392c Laxman Dewangan 2012-10-30 1135 exit_free_master:
dc4dc36056392c Laxman Dewangan 2012-10-30 1136 spi_master_put(master);
dc4dc36056392c Laxman Dewangan 2012-10-30 1137 return ret;
dc4dc36056392c Laxman Dewangan 2012-10-30 1138 }
dc4dc36056392c Laxman Dewangan 2012-10-30 1139
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip