[ti:ti-rt-linux-5.4.y 3680/9325] drivers/pci/endpoint/functions/pci-epf-test.c:237 pci_epf_test_read() warn: possible memory leak of 'buf'
by kernel test robot
tree: git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git ti-rt-linux-5.4.y
head: 679110506d7f5755fd05b3007b24dffd735e816a
commit: d18c9a1ac4bbfff051665c64a8a068036f7e2b56 [3680/9325] PCI: endpoint: Add support to transfer data using DMA
config: i386-randconfig-m021-20200816 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
smatch warnings:
drivers/pci/endpoint/functions/pci-epf-test.c:237 pci_epf_test_read() warn: possible memory leak of 'buf'
git remote add ti git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git
git fetch --no-tags ti ti-rt-linux-5.4.y
git checkout d18c9a1ac4bbfff051665c64a8a068036f7e2b56
vim +/buf +237 drivers/pci/endpoint/functions/pci-epf-test.c
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 157
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 158 static int pci_epf_test_read(struct pci_epf_test *epf_test)
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 159 {
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 160 int ret;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 161 void __iomem *src_addr;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 162 void *buf;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 163 u32 crc32;
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 164 bool use_dma;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 165 phys_addr_t phys_addr;
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 166 phys_addr_t dst_phys_addr;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 167 struct pci_epf *epf = epf_test->epf;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 168 struct device *dev = &epf->dev;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 169 struct pci_epc *epc = epf->epc;
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 170 struct device *dma_dev = epf->epc->dev.parent;
3235b994950d84d Kishon Vijay Abraham I 2017-08-18 171 enum pci_barno test_reg_bar = epf_test->test_reg_bar;
3235b994950d84d Kishon Vijay Abraham I 2017-08-18 172 struct pci_epf_test_reg *reg = epf_test->reg[test_reg_bar];
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 173
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 174 src_addr = pci_epc_mem_alloc_addr(epc, &phys_addr, reg->size);
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 175 if (!src_addr) {
798c0441bec8c46 Gustavo Pimentel 2018-05-14 176 dev_err(dev, "Failed to allocate address\n");
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 177 reg->status = STATUS_SRC_ADDR_INVALID;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 178 ret = -ENOMEM;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 179 goto err;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 180 }
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 181
fd0d7332e649781 Kishon Vijay Abraham I 2020-01-23 182 ret = pci_epc_map_addr(epc, epf->func_no, epf->vfunc_no, phys_addr,
fd0d7332e649781 Kishon Vijay Abraham I 2020-01-23 183 reg->src_addr, reg->size);
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 184 if (ret) {
798c0441bec8c46 Gustavo Pimentel 2018-05-14 185 dev_err(dev, "Failed to map address\n");
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 186 reg->status = STATUS_SRC_ADDR_INVALID;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 187 goto err_addr;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 188 }
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 189
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 190 buf = kzalloc(reg->size, GFP_KERNEL);
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 191 if (!buf) {
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 192 ret = -ENOMEM;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 193 goto err_map_addr;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 194 }
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 195
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 196 use_dma = !!(reg->flags & FLAG_USE_DMA);
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 197 if (use_dma) {
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 198 if (!epf_test->dma_supported) {
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 199 dev_err(dev, "Cannot transfer data using DMA\n");
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 200 ret = -EINVAL;
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 201 goto err_map_addr;
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 202 }
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 203
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 204 dst_phys_addr = dma_map_single(dma_dev, buf, reg->size,
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 205 DMA_FROM_DEVICE);
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 206 if (dma_mapping_error(dma_dev, dst_phys_addr)) {
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 207 dev_err(dev, "Failed to map destination buffer addr\n");
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 208 ret = -ENOMEM;
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 209 goto err_dma_map;
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 210 }
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 211
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 212 ret = pci_epf_data_transfer(epf, dst_phys_addr, phys_addr,
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 213 reg->size);
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 214 if (ret)
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 215 dev_err(dev, "Data transfer failed\n");
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 216
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 217 dma_unmap_single(dma_dev, dst_phys_addr, reg->size,
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 218 DMA_FROM_DEVICE);
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 219 } else {
726dabfde6aa35a Wen Yang 2019-02-11 220 memcpy_fromio(buf, src_addr, reg->size);
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 221 }
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 222
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 223 crc32 = crc32_le(~0, buf, reg->size);
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 224 if (crc32 != reg->checksum)
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 225 ret = -EIO;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 226
d18c9a1ac4bbfff Kishon Vijay Abraham I 2020-02-04 227 err_dma_map:
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 228 kfree(buf);
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 229
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 230 err_map_addr:
fd0d7332e649781 Kishon Vijay Abraham I 2020-01-23 231 pci_epc_unmap_addr(epc, epf->func_no, epf->vfunc_no, phys_addr);
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 232
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 233 err_addr:
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 234 pci_epc_mem_free_addr(epc, phys_addr, src_addr, reg->size);
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 235
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 236 err:
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 @237 return ret;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 238 }
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 239
:::::: The code at line 237 was first introduced by commit
:::::: 349e7a85b25fa6ee82902d9be2cc5f3bec815120 PCI: endpoint: functions: Add an EP function to test PCI
:::::: TO: Kishon Vijay Abraham I <kishon(a)ti.com>
:::::: CC: Bjorn Helgaas <bhelgaas(a)google.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month
Re: [PATCH 16/16] wireless: zydas: convert tasklets to use new tasklet_setup() API
by kernel test robot
Hi Allen,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on wireless-drivers-next/master]
[also build test WARNING on v5.9-rc1 next-20200817]
[cannot apply to wireless-drivers/master ath6kl/ath-next]
[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/Allen-Pais/wirless-convert-taskl...
base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-ne... master
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 9.3.0
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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
drivers/net/wireless/zydas/zd1211rw/zd_usb.c: In function 'zd_usb_reset_rx_idle_timer_tasklet':
drivers/net/wireless/zydas/zd1211rw/zd_usb.c:1145:23: error: implicit declaration of function 'from_tasklet' [-Werror=implicit-function-declaration]
1145 | struct zd_usb *usb = from_tasklet(usb, t, rx.reset_timer_tasklet);
| ^~~~~~~~~~~~
drivers/net/wireless/zydas/zd1211rw/zd_usb.c:1145:44: error: 'rx' undeclared (first use in this function); did you mean 'rq'?
1145 | struct zd_usb *usb = from_tasklet(usb, t, rx.reset_timer_tasklet);
| ^~
| rq
drivers/net/wireless/zydas/zd1211rw/zd_usb.c:1145:44: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/wireless/zydas/zd1211rw/zd_usb.c: In function 'init_usb_rx':
>> drivers/net/wireless/zydas/zd1211rw/zd_usb.c:1181:33: warning: cast between incompatible function types from 'void (*)(struct tasklet_struct *)' to 'void (*)(long unsigned int)' [-Wcast-function-type]
1181 | rx->reset_timer_tasklet.func = (void (*)(unsigned long))
| ^
cc1: some warnings being treated as errors
# https://github.com/0day-ci/linux/commit/b1c5065eea8de31c83b4e7f764b914215...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Allen-Pais/wirless-convert-tasklets-to-use-new-tasklet_setup/20200817-171147
git checkout b1c5065eea8de31c83b4e7f764b9142157f54def
vim +1181 drivers/net/wireless/zydas/zd1211rw/zd_usb.c
1167
1168 static inline void init_usb_rx(struct zd_usb *usb)
1169 {
1170 struct zd_usb_rx *rx = &usb->rx;
1171
1172 spin_lock_init(&rx->lock);
1173 mutex_init(&rx->setup_mutex);
1174 if (interface_to_usbdev(usb->intf)->speed == USB_SPEED_HIGH) {
1175 rx->usb_packet_size = 512;
1176 } else {
1177 rx->usb_packet_size = 64;
1178 }
1179 ZD_ASSERT(rx->fragment_length == 0);
1180 INIT_DELAYED_WORK(&rx->idle_work, zd_rx_idle_timer_handler);
> 1181 rx->reset_timer_tasklet.func = (void (*)(unsigned long))
1182 zd_usb_reset_rx_idle_timer_tasklet;
1183 }
1184
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month
drivers/gpio/gpio-sa1100.c:104:21: sparse: sparse: cast removes address space '__iomem' of expression
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date: 9 weeks ago
config: arm-randconfig-s031-20200816 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-180-g49f7e13a-dirty
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/gpio/gpio-sa1100.c:104:21: sparse: sparse: cast removes address space '__iomem' of expression
>> drivers/gpio/gpio-sa1100.c:104:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void [noderef] __iomem *membase @@ got void * @@
>> drivers/gpio/gpio-sa1100.c:104:21: sparse: expected void [noderef] __iomem *membase
drivers/gpio/gpio-sa1100.c:104:21: sparse: got void *
>> drivers/gpio/gpio-sa1100.c:115:25: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void *base @@ got void [noderef] __iomem *membase @@
drivers/gpio/gpio-sa1100.c:115:25: sparse: expected void *base
>> drivers/gpio/gpio-sa1100.c:115:25: sparse: got void [noderef] __iomem *membase
>> drivers/gpio/gpio-sa1100.c:121:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void * @@
>> drivers/gpio/gpio-sa1100.c:121:9: sparse: expected void volatile [noderef] __iomem *addr
drivers/gpio/gpio-sa1100.c:121:9: sparse: got void *
drivers/gpio/gpio-sa1100.c:122:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void * @@
drivers/gpio/gpio-sa1100.c:122:9: sparse: expected void volatile [noderef] __iomem *addr
drivers/gpio/gpio-sa1100.c:122:9: sparse: got void *
--
>> drivers/video/fbdev/sa1100fb.c:1041:37: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected char [noderef] __iomem *screen_base @@ got unsigned char [usertype] * @@
>> drivers/video/fbdev/sa1100fb.c:1041:37: sparse: expected char [noderef] __iomem *screen_base
drivers/video/fbdev/sa1100fb.c:1041:37: sparse: got unsigned char [usertype] *
drivers/video/fbdev/sa1100fb.c:1219:12: sparse: sparse: symbol 'sa1100fb_init' was not declared. Should it be static?
drivers/video/fbdev/sa1100fb.c:1227:12: sparse: sparse: symbol 'sa1100fb_setup' was not declared. Should it be static?
drivers/video/fbdev/sa1100fb.c:774:17: sparse: sparse: dereference of noderef expression
drivers/video/fbdev/sa1100fb.c:775:17: sparse: sparse: dereference of noderef expression
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
vim +/__iomem +104 drivers/gpio/gpio-sa1100.c
f408c985cefc9b1 drivers/gpio/gpio-sa1100.c Russell King 2011-12-18 91
07242b248119a93 drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 92 static struct sa1100_gpio_chip sa1100_gpio_chip = {
07242b248119a93 drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 93 .chip = {
45528e38173e7d8 arch/arm/mach-sa1100/gpio.c Dmitry Eremin-Solenikov 2008-04-10 94 .label = "gpio",
c65d1fd350fa28d drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 95 .get_direction = sa1100_get_direction,
45528e38173e7d8 arch/arm/mach-sa1100/gpio.c Dmitry Eremin-Solenikov 2008-04-10 96 .direction_input = sa1100_direction_input,
45528e38173e7d8 arch/arm/mach-sa1100/gpio.c Dmitry Eremin-Solenikov 2008-04-10 97 .direction_output = sa1100_direction_output,
45528e38173e7d8 arch/arm/mach-sa1100/gpio.c Dmitry Eremin-Solenikov 2008-04-10 98 .set = sa1100_gpio_set,
45528e38173e7d8 arch/arm/mach-sa1100/gpio.c Dmitry Eremin-Solenikov 2008-04-10 99 .get = sa1100_gpio_get,
f408c985cefc9b1 drivers/gpio/gpio-sa1100.c Russell King 2011-12-18 100 .to_irq = sa1100_to_irq,
45528e38173e7d8 arch/arm/mach-sa1100/gpio.c Dmitry Eremin-Solenikov 2008-04-10 101 .base = 0,
45528e38173e7d8 arch/arm/mach-sa1100/gpio.c Dmitry Eremin-Solenikov 2008-04-10 102 .ngpio = GPIO_MAX + 1,
07242b248119a93 drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 103 },
07242b248119a93 drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 @104 .membase = (void *)&GPLR,
07242b248119a93 drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 105 .irqbase = IRQ_GPIO0,
45528e38173e7d8 arch/arm/mach-sa1100/gpio.c Dmitry Eremin-Solenikov 2008-04-10 106 };
45528e38173e7d8 arch/arm/mach-sa1100/gpio.c Dmitry Eremin-Solenikov 2008-04-10 107
a0ea298d325616b drivers/gpio/gpio-sa1100.c Dmitry Eremin-Solenikov 2015-01-15 108 /*
a0ea298d325616b drivers/gpio/gpio-sa1100.c Dmitry Eremin-Solenikov 2015-01-15 109 * SA1100 GPIO edge detection for IRQs:
a0ea298d325616b drivers/gpio/gpio-sa1100.c Dmitry Eremin-Solenikov 2015-01-15 110 * IRQs are generated on Falling-Edge, Rising-Edge, or both.
a0ea298d325616b drivers/gpio/gpio-sa1100.c Dmitry Eremin-Solenikov 2015-01-15 111 * Use this instead of directly setting GRER/GFER.
a0ea298d325616b drivers/gpio/gpio-sa1100.c Dmitry Eremin-Solenikov 2015-01-15 112 */
07242b248119a93 drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 113 static void sa1100_update_edge_regs(struct sa1100_gpio_chip *sgc)
07242b248119a93 drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 114 {
07242b248119a93 drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 @115 void *base = sgc->membase;
07242b248119a93 drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 116 u32 grer, gfer;
07242b248119a93 drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 117
07242b248119a93 drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 118 grer = sgc->irqrising & sgc->irqmask;
07242b248119a93 drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 119 gfer = sgc->irqfalling & sgc->irqmask;
07242b248119a93 drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 120
07242b248119a93 drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 @121 writel_relaxed(grer, base + R_GRER);
07242b248119a93 drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 122 writel_relaxed(gfer, base + R_GFER);
07242b248119a93 drivers/gpio/gpio-sa1100.c Russell King 2016-08-31 123 }
a0ea298d325616b drivers/gpio/gpio-sa1100.c Dmitry Eremin-Solenikov 2015-01-15 124
:::::: The code at line 104 was first introduced by commit
:::::: 07242b248119a9388a67975aa7fae7c23afc7a07 gpio: sa1100: convert to use IO accessors
:::::: TO: Russell King <rmk+kernel(a)armlinux.org.uk>
:::::: CC: Linus Walleij <linus.walleij(a)linaro.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month
Re: [PATCH] ACPI: ioremap: avoid redundant rounding to OS page size
by kernel test robot
Hi Ard,
I love your patch! Perhaps something to improve:
[auto build test WARNING on pm/linux-next]
[also build test WARNING on arm64/for-next/core arm/for-next soc/for-next v5.9-rc1 next-20200817]
[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/Ard-Biesheuvel/ACPI-ioremap-avoi...
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-s022-20200817 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-180-g49f7e13a-dirty
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/acpi/osl.c:362:19: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __iomem *virt @@ got void * @@
>> drivers/acpi/osl.c:362:19: sparse: expected void [noderef] __iomem *virt
>> drivers/acpi/osl.c:362:19: sparse: got void *
drivers/acpi/osl.c:377:17: sparse: sparse: cast removes address space '__iomem' of expression
drivers/acpi/osl.c:714:1: sparse: sparse: context imbalance in 'acpi_os_read_memory' - wrong count at exit
drivers/acpi/osl.c:747:1: sparse: sparse: context imbalance in 'acpi_os_write_memory' - wrong count at exit
# https://github.com/0day-ci/linux/commit/a34cc34917319aed90ebf9b0fbf414666...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ard-Biesheuvel/ACPI-ioremap-avoid-redundant-rounding-to-OS-page-size/20200817-200603
git checkout a34cc34917319aed90ebf9b0fbf4146666f5f75d
vim +362 drivers/acpi/osl.c
308
309 /**
310 * acpi_os_map_iomem - Get a virtual address for a given physical address range.
311 * @phys: Start of the physical address range to map.
312 * @size: Size of the physical address range to map.
313 *
314 * Look up the given physical address range in the list of existing ACPI memory
315 * mappings. If found, get a reference to it and return a pointer to it (its
316 * virtual address). If not found, map it, add it to that list and return a
317 * pointer to it.
318 *
319 * During early init (when acpi_permanent_mmap has not been set yet) this
320 * routine simply calls __acpi_map_table() to get the job done.
321 */
322 void __iomem __ref
323 *acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)
324 {
325 struct acpi_ioremap *map;
326 void __iomem *virt;
327 acpi_physical_address pg_off;
328 acpi_size pg_sz;
329
330 if (phys > ULONG_MAX) {
331 printk(KERN_ERR PREFIX "Cannot map memory that high\n");
332 return NULL;
333 }
334
335 if (!acpi_permanent_mmap)
336 return __acpi_map_table((unsigned long)phys, size);
337
338 mutex_lock(&acpi_ioremap_lock);
339 /* Check if there's a suitable mapping already. */
340 map = acpi_map_lookup(phys, size);
341 if (map) {
342 map->track.refcount++;
343 goto out;
344 }
345
346 map = kzalloc(sizeof(*map), GFP_KERNEL);
347 if (!map) {
348 mutex_unlock(&acpi_ioremap_lock);
349 return NULL;
350 }
351
352 pg_off = round_down(phys, PAGE_SIZE);
353 pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
354 virt = acpi_map(phys, size);
355 if (!virt) {
356 mutex_unlock(&acpi_ioremap_lock);
357 kfree(map);
358 return NULL;
359 }
360
361 INIT_LIST_HEAD(&map->list);
> 362 map->virt = (void *)((unsigned long)virt & PAGE_MASK);
363 map->phys = pg_off;
364 map->size = pg_sz;
365 map->track.refcount = 1;
366
367 list_add_tail_rcu(&map->list, &acpi_ioremaps);
368
369 out:
370 mutex_unlock(&acpi_ioremap_lock);
371 return virt;
372 }
373 EXPORT_SYMBOL_GPL(acpi_os_map_iomem);
374
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month
[ti:ti-rt-linux-5.4.y 2645/9316] drivers/gpu/drm/tidss/tidss_wb_m2m.c:185 device_run() error: '%pa' expects argument of type argument 4 has type 'struct
by kernel test robot
tree: git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git ti-rt-linux-5.4.y
head: 1770371bdb34438b6bb83c2a1c90f939c8f9d6ab
commit: dae914c5f0f8179f680fd68f60058b2817e9fa8e [2645/9316] drm/tidss: add WB M2M driver
config: i386-randconfig-m021-20200816 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
New smatch warnings:
drivers/gpu/drm/tidss/tidss_wb_m2m.c:185 device_run() error: '%pa' expects argument of type 'phys_addr_t*', argument 4 has type 'struct wbm2m_ctx**'
drivers/gpu/drm/tidss/tidss_wb_m2m.c:297 tidss_wbm2m_irq() error: '%pa' expects argument of type 'phys_addr_t*', argument 4 has type 'struct wbm2m_ctx**'
drivers/gpu/drm/tidss/tidss_wb_m2m.c:389 wbm2m_g_fmt() error: '%pa' expects argument of type 'phys_addr_t*', argument 4 has type 'struct wbm2m_ctx**'
drivers/gpu/drm/tidss/tidss_wb_m2m.c:513 __wbm2m_s_fmt() error: '%pa' expects argument of type 'phys_addr_t*', argument 4 has type 'struct wbm2m_ctx**'
drivers/gpu/drm/tidss/tidss_wb_m2m.c:831 wbm2m_start_streaming() error: '%pa' expects argument of type 'phys_addr_t*', argument 4 has type 'struct wbm2m_ctx**'
drivers/gpu/drm/tidss/tidss_wb_m2m.c:849 wbm2m_stop_streaming() error: '%pa' expects argument of type 'phys_addr_t*', argument 4 has type 'struct wbm2m_ctx**'
drivers/gpu/drm/tidss/tidss_wb_m2m.c:1019 wbm2m_open() error: '%pa' expects argument of type 'phys_addr_t*', argument 4 has type 'struct wbm2m_ctx**'
drivers/gpu/drm/tidss/tidss_wb_m2m.c:1019 wbm2m_open() error: '%pa' expects argument of type 'phys_addr_t*', argument 5 has type 'struct v4l2_m2m_ctx**'
drivers/gpu/drm/tidss/tidss_wb_m2m.c:1044 wbm2m_release() error: '%pa' expects argument of type 'phys_addr_t*', argument 4 has type 'struct wbm2m_ctx**'
Old smatch warnings:
drivers/gpu/drm/tidss/tidss_wb_m2m.c:233 device_run() error: '%pa' expects argument of type 'phys_addr_t*', argument 4 has type 'struct wbm2m_ctx**'
drivers/gpu/drm/tidss/tidss_wb_m2m.c:314 tidss_wbm2m_irq() error: '%pa' expects argument of type 'phys_addr_t*', argument 4 has type 'struct wbm2m_ctx**'
git remote add ti git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git
git fetch --no-tags ti ti-rt-linux-5.4.y
git checkout dae914c5f0f8179f680fd68f60058b2817e9fa8e
vim +185 drivers/gpu/drm/tidss/tidss_wb_m2m.c
130
131 /* device_run() - prepares and starts the device
132 *
133 * This function is only called when both the source and destination
134 * buffers are in place.
135 */
136 static void device_run(void *priv)
137 {
138 struct wbm2m_ctx *ctx = priv;
139 struct wbm2m_dev *dev = ctx->dev;
140 struct wb_q_data *d_q_data = &ctx->q_data[Q_DATA_DST];
141 struct wb_q_data *s_q_data = &ctx->q_data[Q_DATA_SRC];
142 struct vb2_v4l2_buffer *s_vb, *d_vb;
143 struct v4l2_pix_format_mplane *spix, *dpix;
144 struct v4l2_rect *srect, *drect;
145 bool ok;
146
147 s_vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
148 d_vb = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
149
150 /* fill source info */
151 srect = &s_q_data->c_rect;
152 spix = &s_q_data->format.fmt.pix_mp;
153 prepare_plane_state(&ctx->s_state, &ctx->s_fb,
154 spix->pixelformat, ctx->s_cma_gem_obj);
155
156 ctx->s_state.src_w = srect->width << 16;
157 ctx->s_state.src_h = srect->height << 16;
158 ctx->s_state.src_x = srect->left << 16;
159 ctx->s_state.src_y = srect->top << 16;
160 ctx->s_state.crtc_w = srect->width;
161 ctx->s_state.crtc_h = srect->height;
162 ctx->s_state.fb->pitches[0] = spix->plane_fmt[0].bytesperline;
163 ctx->s_state.alpha = DRM_BLEND_ALPHA_OPAQUE;
164 ctx->s_state.color_encoding = DRM_COLOR_YCBCR_BT601;
165 ctx->s_state.color_range = DRM_COLOR_YCBCR_FULL_RANGE;
166
167 ctx->s_cma_gem_obj[0].paddr =
168 vb2_dma_contig_plane_dma_addr(&s_vb->vb2_buf, 0);
169 if (spix->num_planes == 2) {
170 ctx->s_cma_gem_obj[1].paddr =
171 vb2_dma_contig_plane_dma_addr(&s_vb->vb2_buf, 1);
172 ctx->s_state.fb->pitches[1] = spix->plane_fmt[1].bytesperline;
173 } else if (spix->pixelformat == V4L2_PIX_FMT_NV12) {
174 ctx->s_cma_gem_obj[1].paddr = ctx->s_cma_gem_obj[0].paddr +
175 (spix->plane_fmt[0].bytesperline * spix->height);
176 ctx->s_state.fb->pitches[1] = spix->plane_fmt[0].bytesperline;
177 }
178 if (!ctx->s_cma_gem_obj[0].paddr) {
179 log_err(dev,
180 "acquiring source buffer(%d) dma_addr failed\n",
181 (&s_vb->vb2_buf)->index);
182 return;
183 }
184
> 185 log_dbg(dev, "SRC: ctx %pa buf_index %d %dx%d, pitches: %d, cpp: %d, sw %d\n",
186 &ctx, (&s_vb->vb2_buf)->index,
187 ctx->s_state.crtc_w, ctx->s_state.crtc_h,
188 ctx->s_state.fb->pitches[0], ctx->s_state.fb->format->cpp[0],
189 ctx->s_state.fb->pitches[0] / ctx->s_state.fb->format->cpp[0]);
190 if (spix->num_planes == 2 || spix->pixelformat == V4L2_PIX_FMT_NV12) {
191 log_dbg(dev, "SRC: pitches_uv: %d, cpp_uv: %d, sw_uv %d\n",
192 ctx->s_state.fb->pitches[1],
193 ctx->s_state.fb->format->cpp[1],
194 ctx->s_state.fb->pitches[1] /
195 ctx->s_state.fb->format->cpp[1]);
196 }
197
198 /* fill WB info */
199 drect = &d_q_data->c_rect;
200 dpix = &d_q_data->format.fmt.pix_mp;
201 prepare_plane_state(&ctx->d_state, &ctx->d_fb,
202 dpix->pixelformat, ctx->d_cma_gem_obj);
203
204 ctx->d_state.src_w = ctx->s_state.crtc_w << 16;
205 ctx->d_state.src_h = ctx->s_state.crtc_h << 16;
206 ctx->d_state.src_x = drect->left << 16;
207 ctx->d_state.src_y = drect->top << 16;
208 ctx->d_state.crtc_w = drect->width;
209 ctx->d_state.crtc_h = drect->height;
210 ctx->d_state.fb->pitches[0] = dpix->plane_fmt[0].bytesperline;
211 ctx->d_state.alpha = DRM_BLEND_ALPHA_OPAQUE;
212 ctx->d_state.color_encoding = DRM_COLOR_YCBCR_BT601;
213 ctx->d_state.color_range = DRM_COLOR_YCBCR_FULL_RANGE;
214
215 ctx->d_cma_gem_obj[0].paddr =
216 vb2_dma_contig_plane_dma_addr(&d_vb->vb2_buf, 0);
217 if (dpix->num_planes == 2) {
218 ctx->d_cma_gem_obj[1].paddr =
219 vb2_dma_contig_plane_dma_addr(&d_vb->vb2_buf, 1);
220 ctx->d_state.fb->pitches[1] = dpix->plane_fmt[1].bytesperline;
221 } else if (dpix->pixelformat == V4L2_PIX_FMT_NV12) {
222 ctx->d_cma_gem_obj[1].paddr = ctx->d_cma_gem_obj[0].paddr +
223 (dpix->plane_fmt[0].bytesperline * dpix->height);
224 ctx->d_state.fb->pitches[1] = dpix->plane_fmt[0].bytesperline;
225 }
226 if (!ctx->d_cma_gem_obj[0].paddr) {
227 log_err(dev,
228 "acquiring destination buffer(%d) dma_addr failed\n",
229 (&d_vb->vb2_buf)->index);
230 return;
231 }
232
233 log_dbg(dev, "DST: ctx %pa buf_index %d %dx%d, pitches: %d, cpp: %d, sw %d\n",
234 &ctx, (&d_vb->vb2_buf)->index,
235 ctx->d_state.crtc_w, ctx->d_state.crtc_h,
236 ctx->d_state.fb->pitches[0], ctx->d_state.fb->format->cpp[0],
237 ctx->d_state.fb->pitches[0] / ctx->d_state.fb->format->cpp[0]);
238 if (dpix->num_planes == 2 || dpix->pixelformat == V4L2_PIX_FMT_NV12) {
239 log_dbg(dev, "DST: pitches_uv: %d, cpp_uv: %d, sw_uv %d\n",
240 ctx->d_state.fb->pitches[1],
241 ctx->d_state.fb->format->cpp[1],
242 ctx->d_state.fb->pitches[1] /
243 ctx->d_state.fb->format->cpp[1]);
244 }
245
246 ok = wbm2m_convert(dev, ctx->dev->plane,
247 (const struct drm_plane_state *)&ctx->s_state,
248 (const struct drm_plane_state *)&ctx->d_state);
249 if (!ok) {
250 log_err(dev,
251 "Conversion setup failed, check source and destination parameters\n"
252 );
253 log_err(dev, "\tSRC: %dx%d, fmt: %4.4s sw %d\n",
254 ctx->s_state.crtc_w, ctx->s_state.crtc_h,
255 (char *)&spix->pixelformat,
256 ctx->s_state.fb->pitches[0] /
257 ctx->s_state.fb->format->cpp[0]);
258 log_err(dev, "\tDST: %dx%d, fmt: %4.4s sw %d\n",
259 ctx->d_state.crtc_w, ctx->d_state.crtc_h,
260 (char *)&dpix->pixelformat,
261 ctx->d_state.fb->pitches[0] /
262 ctx->d_state.fb->format->cpp[0]);
263 return;
264 }
265 }
266
267 void tidss_wbm2m_irq(struct wbm2m_dev *wbm2m, u64 irqstatus)
268 {
269 struct wbm2m_ctx *ctx;
270 struct vb2_v4l2_buffer *s_vb, *d_vb;
271 unsigned long flags;
272
273 if (irqstatus & DSS_IRQ_DEVICE_WBBUFFEROVERFLOW)
274 log_err(wbm2m, "WB: UNDERFLOW\n");
275
276 if (irqstatus & DSS_IRQ_DEVICE_WBUNCOMPLETEERROR)
277 log_err(wbm2m, "WB: UNCOMPLETEERROR\n");
278
279 if (irqstatus & DSS_IRQ_DEVICE_WBSECURITYVIOLATION)
280 log_err(wbm2m, "WB: SECURITYVIOLATION\n");
281
282 if (irqstatus & DSS_IRQ_DEVICE_WBSYNC)
283 log_dbg(wbm2m, "WB: SYNC\n");
284
285 /* If DISPC_IRQ_FRAMEDONEWB is not set then we are done */
286 if (!(irqstatus & DSS_IRQ_DEVICE_FRAMEDONEWB))
287 goto handled;
288
289 log_dbg(wbm2m, "WB: FRAMEDONE\n");
290
291 ctx = v4l2_m2m_get_curr_priv(wbm2m->m2m_dev);
292 if (!ctx) {
293 log_err(wbm2m, "instance released before end of transaction\n");
294 goto handled;
295 }
296
> 297 log_dbg(ctx->dev, "ctx %pa\n", &ctx);
298
299 s_vb = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);
300 d_vb = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx);
301 if (!s_vb || !d_vb) {
302 log_err(wbm2m, "source or dest vb pointer is NULL!!");
303 goto handled;
304 }
305
306 d_vb->flags = s_vb->flags;
307
308 d_vb->vb2_buf.timestamp = s_vb->vb2_buf.timestamp;
309 if (s_vb->flags & V4L2_BUF_FLAG_TIMECODE)
310 d_vb->timecode = s_vb->timecode;
311
312 d_vb->sequence = ctx->sequence;
313 s_vb->sequence = ctx->sequence;
314 log_dbg(wbm2m, "ctx %pa sequence %d\n",
315 &ctx, ctx->sequence);
316
317 d_vb->field = V4L2_FIELD_NONE;
318 ctx->sequence++;
319
320 spin_lock_irqsave(&wbm2m->lock, flags);
321
322 v4l2_m2m_buf_done(s_vb, VB2_BUF_STATE_DONE);
323 v4l2_m2m_buf_done(d_vb, VB2_BUF_STATE_DONE);
324
325 spin_unlock_irqrestore(&wbm2m->lock, flags);
326
327 v4l2_m2m_job_finish(wbm2m->m2m_dev, ctx->fh.m2m_ctx);
328 handled:
329 return;
330 }
331
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month
Re: [PATCH] ACPI: ioremap: avoid redundant rounding to OS page size
by kernel test robot
Hi Ard,
I love your patch! Perhaps something to improve:
[auto build test WARNING on pm/linux-next]
[also build test WARNING on arm64/for-next/core arm/for-next soc/for-next v5.9-rc1 next-20200817]
[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/Ard-Biesheuvel/ACPI-ioremap-avoi...
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-a013-20200817 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project de71b46a519db014ce906a39f8a0e1b235ef1568)
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(a)intel.com>
All warnings (new ones prefixed by >>):
>> drivers/acpi/osl.c:341:6: warning: variable 'virt' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (map) {
^~~
drivers/acpi/osl.c:371:9: note: uninitialized use occurs here
return virt;
^~~~
drivers/acpi/osl.c:341:2: note: remove the 'if' if its condition is always false
if (map) {
^~~~~~~~~~
drivers/acpi/osl.c:326:20: note: initialize the variable 'virt' to silence this warning
void __iomem *virt;
^
= NULL
1 warning generated.
# https://github.com/0day-ci/linux/commit/a34cc34917319aed90ebf9b0fbf414666...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ard-Biesheuvel/ACPI-ioremap-avoid-redundant-rounding-to-OS-page-size/20200817-200603
git checkout a34cc34917319aed90ebf9b0fbf4146666f5f75d
vim +341 drivers/acpi/osl.c
ba242d5b1a84bc Myron Stowe 2012-01-20 308
9d128ed17c672b Rafael J. Wysocki 2016-01-02 309 /**
9d128ed17c672b Rafael J. Wysocki 2016-01-02 310 * acpi_os_map_iomem - Get a virtual address for a given physical address range.
9d128ed17c672b Rafael J. Wysocki 2016-01-02 311 * @phys: Start of the physical address range to map.
9d128ed17c672b Rafael J. Wysocki 2016-01-02 312 * @size: Size of the physical address range to map.
9d128ed17c672b Rafael J. Wysocki 2016-01-02 313 *
9d128ed17c672b Rafael J. Wysocki 2016-01-02 314 * Look up the given physical address range in the list of existing ACPI memory
9d128ed17c672b Rafael J. Wysocki 2016-01-02 315 * mappings. If found, get a reference to it and return a pointer to it (its
9d128ed17c672b Rafael J. Wysocki 2016-01-02 316 * virtual address). If not found, map it, add it to that list and return a
9d128ed17c672b Rafael J. Wysocki 2016-01-02 317 * pointer to it.
9d128ed17c672b Rafael J. Wysocki 2016-01-02 318 *
8d3523fb3b7274 Lv Zheng 2016-12-14 319 * During early init (when acpi_permanent_mmap has not been set yet) this
9d128ed17c672b Rafael J. Wysocki 2016-01-02 320 * routine simply calls __acpi_map_table() to get the job done.
9d128ed17c672b Rafael J. Wysocki 2016-01-02 321 */
9fe51603d95341 Qian Cai 2019-06-03 322 void __iomem __ref
9fe51603d95341 Qian Cai 2019-06-03 323 *acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)
^1da177e4c3f41 Linus Torvalds 2005-04-16 324 {
7ffd0443f25024 Rafael J. Wysocki 2011-02-08 325 struct acpi_ioremap *map;
620242ae8c3d9c Myron Stowe 2010-10-21 326 void __iomem *virt;
2d6d9fd3a54a28 Rafael J. Wysocki 2011-01-19 327 acpi_physical_address pg_off;
2d6d9fd3a54a28 Rafael J. Wysocki 2011-01-19 328 acpi_size pg_sz;
620242ae8c3d9c Myron Stowe 2010-10-21 329
^1da177e4c3f41 Linus Torvalds 2005-04-16 330 if (phys > ULONG_MAX) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 331 printk(KERN_ERR PREFIX "Cannot map memory that high\n");
70c0846e430881 Randy Dunlap 2007-02-13 332 return NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 333 }
620242ae8c3d9c Myron Stowe 2010-10-21 334
8d3523fb3b7274 Lv Zheng 2016-12-14 335 if (!acpi_permanent_mmap)
ad71860a17ba33 Alexey Starikovskiy 2007-02-02 336 return __acpi_map_table((unsigned long)phys, size);
620242ae8c3d9c Myron Stowe 2010-10-21 337
7ffd0443f25024 Rafael J. Wysocki 2011-02-08 338 mutex_lock(&acpi_ioremap_lock);
7ffd0443f25024 Rafael J. Wysocki 2011-02-08 339 /* Check if there's a suitable mapping already. */
7ffd0443f25024 Rafael J. Wysocki 2011-02-08 340 map = acpi_map_lookup(phys, size);
7ffd0443f25024 Rafael J. Wysocki 2011-02-08 @341 if (map) {
1757659d022b73 Rafael J. Wysocki 2020-07-02 342 map->track.refcount++;
7ffd0443f25024 Rafael J. Wysocki 2011-02-08 343 goto out;
7ffd0443f25024 Rafael J. Wysocki 2011-02-08 344 }
7ffd0443f25024 Rafael J. Wysocki 2011-02-08 345
620242ae8c3d9c Myron Stowe 2010-10-21 346 map = kzalloc(sizeof(*map), GFP_KERNEL);
7ffd0443f25024 Rafael J. Wysocki 2011-02-08 347 if (!map) {
7ffd0443f25024 Rafael J. Wysocki 2011-02-08 348 mutex_unlock(&acpi_ioremap_lock);
620242ae8c3d9c Myron Stowe 2010-10-21 349 return NULL;
7ffd0443f25024 Rafael J. Wysocki 2011-02-08 350 }
620242ae8c3d9c Myron Stowe 2010-10-21 351
4a3cba5e72a523 Myron Stowe 2010-10-21 352 pg_off = round_down(phys, PAGE_SIZE);
4a3cba5e72a523 Myron Stowe 2010-10-21 353 pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
a34cc34917319a Ard Biesheuvel 2020-08-17 354 virt = acpi_map(phys, size);
620242ae8c3d9c Myron Stowe 2010-10-21 355 if (!virt) {
7ffd0443f25024 Rafael J. Wysocki 2011-02-08 356 mutex_unlock(&acpi_ioremap_lock);
620242ae8c3d9c Myron Stowe 2010-10-21 357 kfree(map);
620242ae8c3d9c Myron Stowe 2010-10-21 358 return NULL;
620242ae8c3d9c Myron Stowe 2010-10-21 359 }
620242ae8c3d9c Myron Stowe 2010-10-21 360
620242ae8c3d9c Myron Stowe 2010-10-21 361 INIT_LIST_HEAD(&map->list);
a34cc34917319a Ard Biesheuvel 2020-08-17 362 map->virt = (void *)((unsigned long)virt & PAGE_MASK);
4a3cba5e72a523 Myron Stowe 2010-10-21 363 map->phys = pg_off;
4a3cba5e72a523 Myron Stowe 2010-10-21 364 map->size = pg_sz;
1757659d022b73 Rafael J. Wysocki 2020-07-02 365 map->track.refcount = 1;
620242ae8c3d9c Myron Stowe 2010-10-21 366
78cdb3ed405379 Myron Stowe 2010-10-21 367 list_add_tail_rcu(&map->list, &acpi_ioremaps);
620242ae8c3d9c Myron Stowe 2010-10-21 368
7ffd0443f25024 Rafael J. Wysocki 2011-02-08 369 out:
7ffd0443f25024 Rafael J. Wysocki 2011-02-08 370 mutex_unlock(&acpi_ioremap_lock);
a34cc34917319a Ard Biesheuvel 2020-08-17 371 return virt;
^1da177e4c3f41 Linus Torvalds 2005-04-16 372 }
a238317ce81855 Lv Zheng 2014-05-20 373 EXPORT_SYMBOL_GPL(acpi_os_map_iomem);
a238317ce81855 Lv Zheng 2014-05-20 374
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month
Re: [PATCH 15/16] wireless: realtek: convert tasklets to use new tasklet_setup() API
by kernel test robot
Hi Allen,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on wireless-drivers-next/master]
[also build test WARNING on v5.9-rc1 next-20200817]
[cannot apply to wireless-drivers/master ath6kl/ath-next]
[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/Allen-Pais/wirless-convert-taskl...
base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-ne... master
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 9.3.0
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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
drivers/net/wireless/realtek/rtlwifi/usb.c: In function '_rtl_usb_init_rx':
>> drivers/net/wireless/realtek/rtlwifi/usb.c:313:33: warning: cast between incompatible function types from 'void (*)(struct tasklet_struct *)' to 'void (*)(long unsigned int)' [-Wcast-function-type]
313 | rtlusb->rx_work_tasklet.func = (void(*)(unsigned long))_rtl_rx_work;
| ^
drivers/net/wireless/realtek/rtlwifi/usb.c: In function '_rtl_rx_work':
drivers/net/wireless/realtek/rtlwifi/usb.c:532:27: error: implicit declaration of function 'from_tasklet' [-Werror=implicit-function-declaration]
532 | struct rtl_usb *rtlusb = from_tasklet(rtlusb, t, rx_work_tasklet);
| ^~~~~~~~~~~~
drivers/net/wireless/realtek/rtlwifi/usb.c:532:51: error: 'rx_work_tasklet' undeclared (first use in this function)
532 | struct rtl_usb *rtlusb = from_tasklet(rtlusb, t, rx_work_tasklet);
| ^~~~~~~~~~~~~~~
drivers/net/wireless/realtek/rtlwifi/usb.c:532:51: note: each undeclared identifier is reported only once for each function it appears in
cc1: some warnings being treated as errors
# https://github.com/0day-ci/linux/commit/b985c52fd11092396a6b0bd4b208d4b99...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Allen-Pais/wirless-convert-tasklets-to-use-new-tasklet_setup/20200817-171147
git checkout b985c52fd11092396a6b0bd4b208d4b99269efcf
vim +313 drivers/net/wireless/realtek/rtlwifi/usb.c
293
294 static int _rtl_usb_init_rx(struct ieee80211_hw *hw)
295 {
296 struct rtl_priv *rtlpriv = rtl_priv(hw);
297 struct rtl_usb_priv *usb_priv = rtl_usbpriv(hw);
298 struct rtl_usb *rtlusb = rtl_usbdev(usb_priv);
299
300 rtlusb->rx_max_size = rtlpriv->cfg->usb_interface_cfg->rx_max_size;
301 rtlusb->rx_urb_num = rtlpriv->cfg->usb_interface_cfg->rx_urb_num;
302 rtlusb->in_ep = rtlpriv->cfg->usb_interface_cfg->in_ep_num;
303 rtlusb->usb_rx_hdl = rtlpriv->cfg->usb_interface_cfg->usb_rx_hdl;
304 rtlusb->usb_rx_segregate_hdl =
305 rtlpriv->cfg->usb_interface_cfg->usb_rx_segregate_hdl;
306
307 pr_info("rx_max_size %d, rx_urb_num %d, in_ep %d\n",
308 rtlusb->rx_max_size, rtlusb->rx_urb_num, rtlusb->in_ep);
309 init_usb_anchor(&rtlusb->rx_submitted);
310 init_usb_anchor(&rtlusb->rx_cleanup_urbs);
311
312 skb_queue_head_init(&rtlusb->rx_queue);
> 313 rtlusb->rx_work_tasklet.func = (void(*)(unsigned long))_rtl_rx_work;
314
315 return 0;
316 }
317
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month
[PATCH] printk: fix ifnullfree.cocci warnings
by Julia Lawall
Make the code a little simpler by dropping
some unneeded tests.
Generated by: scripts/coccinelle/free/ifnullfree.cocci
Fixes: c406fbce2054 ("printk: implement syslog")
CC: John Ogness <john.ogness(a)linutronix.de>
Signed-off-by: kernel test robot <lkp(a)intel.com>
---
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-5.4.y-rt
head: 5fbf1e70f11dba64cc05c9d85120a3aa7c67a4a2
commit: c406fbce2054efbf812b3d811ed23a872f719db9 [43/325] printk: implement syslog
:::::: branch date: 4 months ago
:::::: commit date: 7 months ago
printk.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1539,10 +1539,8 @@ static int syslog_print_all(char __user
if (clear && !seq)
syslog_clear();
- if (text)
- kfree(text);
- if (msgbuf)
- kfree(msgbuf);
+ kfree(text);
+ kfree(msgbuf);
return len;
}
@@ -1695,10 +1693,8 @@ int do_syslog(int type, char __user *buf
break;
}
out:
- if (msgbuf)
- kfree(msgbuf);
- if (text)
- kfree(text);
+ kfree(msgbuf);
+ kfree(text);
return error;
}
2 years, 1 month
Re: [PATCH] soc: qcom: llcc: Support chipsets that can write to llcc registers
by kernel test robot
Hi Sai,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linux/master]
[also build test WARNING on linus/master v5.9-rc1 next-20200817]
[cannot apply to agross-msm/qcom/for-next]
[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/Sai-Prakash-Ranjan/soc-qcom-llcc...
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git bcf876870b95592b52519ed4aafcf9d95999bc9c
config: mips-randconfig-r006-20200817 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project de71b46a519db014ce906a39f8a0e1b235ef1568)
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 mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
drivers/soc/qcom/llcc-qcom.c:343:28: warning: unused variable 'np' [-Wunused-variable]
const struct device_node *np = dev_of_node(&pdev->dev);
^
>> drivers/soc/qcom/llcc-qcom.c:324:34: warning: unused variable 'qcom_llcc_configure_of_match' [-Wunused-const-variable]
static const struct of_device_id qcom_llcc_configure_of_match[] = {
^
2 warnings generated.
# https://github.com/0day-ci/linux/commit/69ff7ebbde628483bfe9eacd588984bda...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sai-Prakash-Ranjan/soc-qcom-llcc-Support-chipsets-that-can-write-to-llcc-registers/20200817-161342
git checkout 69ff7ebbde628483bfe9eacd588984bdae4d6121
vim +/qcom_llcc_configure_of_match +324 drivers/soc/qcom/llcc-qcom.c
323
> 324 static const struct of_device_id qcom_llcc_configure_of_match[] = {
325 { .compatible = "qcom,sc7180-llcc" },
326 { }
327 };
328
329 static int qcom_llcc_cfg_program(struct platform_device *pdev)
330 {
331 int i;
332 u32 attr1_cfg;
333 u32 attr0_cfg;
334 u32 attr1_val;
335 u32 attr0_val;
336 u32 max_cap_cacheline;
337 u32 sz;
338 u32 disable_cap_alloc = 0, retain_pc = 0;
339 int ret = 0;
340 const struct llcc_slice_config *llcc_table;
341 struct llcc_slice_desc desc;
342 const struct of_device_id *llcc_configure;
> 343 const struct device_node *np = dev_of_node(&pdev->dev);
344
345 sz = drv_data->cfg_size;
346 llcc_table = drv_data->cfg;
347
348 llcc_configure = of_match_node(qcom_llcc_configure_of_match, np);
349
350 for (i = 0; i < sz; i++) {
351 attr1_cfg = LLCC_TRP_ATTR1_CFGn(llcc_table[i].slice_id);
352 attr0_cfg = LLCC_TRP_ATTR0_CFGn(llcc_table[i].slice_id);
353
354 attr1_val = llcc_table[i].cache_mode;
355 attr1_val |= llcc_table[i].probe_target_ways <<
356 ATTR1_PROBE_TARGET_WAYS_SHIFT;
357 attr1_val |= llcc_table[i].fixed_size <<
358 ATTR1_FIXED_SIZE_SHIFT;
359 attr1_val |= llcc_table[i].priority <<
360 ATTR1_PRIORITY_SHIFT;
361
362 max_cap_cacheline = MAX_CAP_TO_BYTES(llcc_table[i].max_cap);
363
364 /* LLCC instances can vary for each target.
365 * The SW writes to broadcast register which gets propagated
366 * to each llcc instace (llcc0,.. llccN).
367 * Since the size of the memory is divided equally amongst the
368 * llcc instances, we need to configure the max cap accordingly.
369 */
370 max_cap_cacheline = max_cap_cacheline / drv_data->num_banks;
371 max_cap_cacheline >>= CACHE_LINE_SIZE_SHIFT;
372 attr1_val |= max_cap_cacheline << ATTR1_MAX_CAP_SHIFT;
373
374 attr0_val = llcc_table[i].res_ways & ATTR0_RES_WAYS_MASK;
375 attr0_val |= llcc_table[i].bonus_ways << ATTR0_BONUS_WAYS_SHIFT;
376
377 ret = regmap_write(drv_data->bcast_regmap, attr1_cfg,
378 attr1_val);
379 if (ret)
380 return ret;
381 ret = regmap_write(drv_data->bcast_regmap, attr0_cfg,
382 attr0_val);
383 if (ret)
384 return ret;
385
386 if (llcc_configure) {
387 disable_cap_alloc |= llcc_table[i].dis_cap_alloc << llcc_table[i].slice_id;
388 ret = regmap_write(drv_data->bcast_regmap,
389 LLCC_TRP_SCID_DIS_CAP_ALLOC, disable_cap_alloc);
390 if (ret)
391 return ret;
392
393 retain_pc |= llcc_table[i].retain_on_pc << llcc_table[i].slice_id;
394 ret = regmap_write(drv_data->bcast_regmap,
395 LLCC_TRP_PCB_ACT, retain_pc);
396 if (ret)
397 return ret;
398 }
399
400 if (llcc_table[i].activate_on_init) {
401 desc.slice_id = llcc_table[i].slice_id;
402 ret = llcc_slice_activate(&desc);
403 }
404 }
405 return ret;
406 }
407
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month
[leon-rdma:rdma-next 57/68] drivers/infiniband/core/counters.c:527:9: warning: variable 'ret' is uninitialized when used here
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git rdma-next
head: f0e6dbf4759c482e4397ccb126d889faf17fb65a
commit: 20f204b9a3deedb8adb820859e683197e57fc61e [57/68] RDMA/counter: Combine allocation and bind logic
config: x86_64-randconfig-a012-20200817 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project de71b46a519db014ce906a39f8a0e1b235ef1568)
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
git checkout 20f204b9a3deedb8adb820859e683197e57fc61e
# 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(a)intel.com>
All warnings (new ones prefixed by >>):
>> drivers/infiniband/core/counters.c:527:9: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
return ret;
^~~
drivers/infiniband/core/counters.c:496:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 warning generated.
# https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/commi...
git remote add leon-rdma https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git
git fetch --no-tags leon-rdma rdma-next
git checkout 20f204b9a3deedb8adb820859e683197e57fc61e
vim +/ret +527 drivers/infiniband/core/counters.c
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 485
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 486 /**
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 487 * rdma_counter_bind_qpn_alloc() - Alloc a counter and bind QP @qp_num to it
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 488 * The id of new counter is returned in @counter_id
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 489 */
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 490 int rdma_counter_bind_qpn_alloc(struct ib_device *dev, u8 port,
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 491 u32 qp_num, u32 *counter_id)
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 492 {
663912a6378a34f Mark Zhang 2019-09-16 493 struct rdma_port_counter *port_counter;
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 494 struct rdma_counter *counter;
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 495 struct ib_qp *qp;
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 496 int ret;
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 497
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 498 if (!rdma_is_port_valid(dev, port))
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 499 return -EINVAL;
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 500
663912a6378a34f Mark Zhang 2019-09-16 501 port_counter = &dev->port_data[port].port_counter;
663912a6378a34f Mark Zhang 2019-09-16 502 if (!port_counter->hstats)
d97de8887a12c59 Mark Zhang 2019-08-07 503 return -EOPNOTSUPP;
d97de8887a12c59 Mark Zhang 2019-08-07 504
663912a6378a34f Mark Zhang 2019-09-16 505 if (port_counter->mode.mode == RDMA_COUNTER_MODE_AUTO)
663912a6378a34f Mark Zhang 2019-09-16 506 return -EINVAL;
663912a6378a34f Mark Zhang 2019-09-16 507
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 508 qp = rdma_counter_get_qp(dev, qp_num);
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 509 if (!qp)
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 510 return -ENOENT;
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 511
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 512 if (rdma_is_port_valid(dev, qp->port) && (qp->port != port)) {
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 513 ret = -EINVAL;
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 514 goto err;
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 515 }
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 516
20f204b9a3deedb Leon Romanovsky 2020-08-16 517 counter = alloc_and_bind(dev, port, qp, RDMA_COUNTER_MODE_MANUAL);
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 518 if (!counter) {
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 519 ret = -ENOMEM;
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 520 goto err;
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 521 }
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 522
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 523 if (counter_id)
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 524 *counter_id = counter->id;
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 525
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 526 rdma_restrack_put(&qp->res);
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 @527 return ret;
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 528
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 529 err:
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 530 rdma_restrack_put(&qp->res);
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 531 return ret;
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 532 }
1bd8e0a9d0fd1be Mark Zhang 2019-07-02 533
:::::: The code at line 527 was first introduced by commit
:::::: 1bd8e0a9d0fd1be03d2833a0c15ac676bdf275d8 RDMA/counter: Allow manual mode configuration support
:::::: TO: Mark Zhang <markz(a)mellanox.com>
:::::: CC: Jason Gunthorpe <jgg(a)mellanox.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years, 1 month