drivers/misc/mic/host/mic_main.c:209 mic_probe() warn: missing error code 'rc'
PATCH 14423/18271 drivers/misc/mic/host/mic_main.c:209 mic_probe() warn: missing error code 'rc'
tree: https://github.com/Freescale/linux-fslc 5.4-2.3.x-imx head: e67919750cd7d48b9321b79dbbc6d0709e5b53df commit: c27a982e3ef1422c74ca1b628a6b35118e6a3ed8 [14423/18271] MLK-24935-2 misc: vop: use dma_alloc_coherent to allocate vrings and device page directly config: x86_64-randconfig-m001-20210421 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>
Reported-by Dan Carpenter <[email protected]>
smatch warnings:drivers/misc/mic/host/mic_main.c:209 mic_probe() warn: missing error code 'rc'
vim +/rc +209 drivers/misc/mic/host/mic_main.c
b170d8ce3f81bd Sudeep Dutt 2013-09-05 132 static int mic_probe(struct pci_dev *pdev,
b170d8ce3f81bd Sudeep Dutt 2013-09-05 133 const struct pci_device_id *ent)
b170d8ce3f81bd Sudeep Dutt 2013-09-05 134 {
b170d8ce3f81bd Sudeep Dutt 2013-09-05 135 int rc;
b170d8ce3f81bd Sudeep Dutt 2013-09-05 136 struct mic_device *mdev;
b170d8ce3f81bd Sudeep Dutt 2013-09-05 137
b170d8ce3f81bd Sudeep Dutt 2013-09-05 138 mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 139 if (!mdev) {
b170d8ce3f81bd Sudeep Dutt 2013-09-05 140 rc = -ENOMEM;
b170d8ce3f81bd Sudeep Dutt 2013-09-05 141 dev_err(&pdev->dev, "mdev kmalloc failed rc %d\n", rc);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 142 goto mdev_alloc_fail;
b170d8ce3f81bd Sudeep Dutt 2013-09-05 143 }
b170d8ce3f81bd Sudeep Dutt 2013-09-05 144 mdev->id = ida_simple_get(&g_mic_ida, 0, MIC_MAX_NUM_DEVS, GFP_KERNEL);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 145 if (mdev->id < 0) {
b170d8ce3f81bd Sudeep Dutt 2013-09-05 146 rc = mdev->id;
b170d8ce3f81bd Sudeep Dutt 2013-09-05 147 dev_err(&pdev->dev, "ida_simple_get failed rc %d\n", rc);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 148 goto ida_fail;
b170d8ce3f81bd Sudeep Dutt 2013-09-05 149 }
b170d8ce3f81bd Sudeep Dutt 2013-09-05 150
1da2b3eeef3667 Ashutosh Dixit 2015-09-29 151 mic_device_init(mdev, pdev);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 152
b170d8ce3f81bd Sudeep Dutt 2013-09-05 153 rc = pci_enable_device(pdev);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 154 if (rc) {
b170d8ce3f81bd Sudeep Dutt 2013-09-05 155 dev_err(&pdev->dev, "failed to enable pci device.\n");
1da2b3eeef3667 Ashutosh Dixit 2015-09-29 156 goto ida_remove;
b170d8ce3f81bd Sudeep Dutt 2013-09-05 157 }
b170d8ce3f81bd Sudeep Dutt 2013-09-05 158
b170d8ce3f81bd Sudeep Dutt 2013-09-05 159 pci_set_master(pdev);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 160
b170d8ce3f81bd Sudeep Dutt 2013-09-05 161 rc = pci_request_regions(pdev, mic_driver_name);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 162 if (rc) {
b170d8ce3f81bd Sudeep Dutt 2013-09-05 163 dev_err(&pdev->dev, "failed to get pci regions.\n");
b170d8ce3f81bd Sudeep Dutt 2013-09-05 164 goto disable_device;
b170d8ce3f81bd Sudeep Dutt 2013-09-05 165 }
b170d8ce3f81bd Sudeep Dutt 2013-09-05 166
b170d8ce3f81bd Sudeep Dutt 2013-09-05 167 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
b170d8ce3f81bd Sudeep Dutt 2013-09-05 168 if (rc) {
b170d8ce3f81bd Sudeep Dutt 2013-09-05 169 dev_err(&pdev->dev, "Cannot set DMA mask\n");
b170d8ce3f81bd Sudeep Dutt 2013-09-05 170 goto release_regions;
b170d8ce3f81bd Sudeep Dutt 2013-09-05 171 }
b170d8ce3f81bd Sudeep Dutt 2013-09-05 172
b170d8ce3f81bd Sudeep Dutt 2013-09-05 173 mdev->mmio.pa = pci_resource_start(pdev, mdev->ops->mmio_bar);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 174 mdev->mmio.len = pci_resource_len(pdev, mdev->ops->mmio_bar);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 175 mdev->mmio.va = pci_ioremap_bar(pdev, mdev->ops->mmio_bar);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 176 if (!mdev->mmio.va) {
b170d8ce3f81bd Sudeep Dutt 2013-09-05 177 dev_err(&pdev->dev, "Cannot remap MMIO BAR\n");
b170d8ce3f81bd Sudeep Dutt 2013-09-05 178 rc = -EIO;
b170d8ce3f81bd Sudeep Dutt 2013-09-05 179 goto release_regions;
b170d8ce3f81bd Sudeep Dutt 2013-09-05 180 }
b170d8ce3f81bd Sudeep Dutt 2013-09-05 181
b170d8ce3f81bd Sudeep Dutt 2013-09-05 182 mdev->aper.pa = pci_resource_start(pdev, mdev->ops->aper_bar);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 183 mdev->aper.len = pci_resource_len(pdev, mdev->ops->aper_bar);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 184 mdev->aper.va = ioremap_wc(mdev->aper.pa, mdev->aper.len);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 185 if (!mdev->aper.va) {
b170d8ce3f81bd Sudeep Dutt 2013-09-05 186 dev_err(&pdev->dev, "Cannot remap Aperture BAR\n");
b170d8ce3f81bd Sudeep Dutt 2013-09-05 187 rc = -EIO;
b170d8ce3f81bd Sudeep Dutt 2013-09-05 188 goto unmap_mmio;
b170d8ce3f81bd Sudeep Dutt 2013-09-05 189 }
b170d8ce3f81bd Sudeep Dutt 2013-09-05 190
a01e28f692088e Dasaratharaman Chandramouli 2013-09-05 191 mdev->intr_ops->intr_init(mdev);
a01e28f692088e Dasaratharaman Chandramouli 2013-09-05 192 rc = mic_setup_interrupts(mdev, pdev);
a01e28f692088e Dasaratharaman Chandramouli 2013-09-05 193 if (rc) {
a01e28f692088e Dasaratharaman Chandramouli 2013-09-05 194 dev_err(&pdev->dev, "mic_setup_interrupts failed %d\n", rc);
a01e28f692088e Dasaratharaman Chandramouli 2013-09-05 195 goto unmap_aper;
a01e28f692088e Dasaratharaman Chandramouli 2013-09-05 196 }
a01e28f692088e Dasaratharaman Chandramouli 2013-09-05 197 rc = mic_smpt_init(mdev);
a01e28f692088e Dasaratharaman Chandramouli 2013-09-05 198 if (rc) {
a01e28f692088e Dasaratharaman Chandramouli 2013-09-05 199 dev_err(&pdev->dev, "smpt_init failed %d\n", rc);
a01e28f692088e Dasaratharaman Chandramouli 2013-09-05 200 goto free_interrupts;
a01e28f692088e Dasaratharaman Chandramouli 2013-09-05 201 }
a01e28f692088e Dasaratharaman Chandramouli 2013-09-05 202
b170d8ce3f81bd Sudeep Dutt 2013-09-05 203 pci_set_drvdata(pdev, mdev);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 204
c27a982e3ef142 Sherry Sun 2020-10-29 205 mdev->dp = dma_alloc_coherent(&pdev->dev, MIC_DP_SIZE,
c27a982e3ef142 Sherry Sun 2020-10-29 206 &mdev->dp_dma_addr, GFP_KERNEL);
c27a982e3ef142 Sherry Sun 2020-10-29 207 if (!mdev->dp) {
c27a982e3ef142 Sherry Sun 2020-10-29 208 dev_err(&pdev->dev, "failed to allocate device page\n");1da2b3eeef3667 Ashutosh Dixit 2015-09-29 @209 goto smpt_uninit;
"rc = -ENOMEM;"
3a6a9201897c64 Sudeep Dutt 2013-09-05 210 }
c27a982e3ef142 Sherry Sun 2020-10-29 211
c27a982e3ef142 Sherry Sun 2020-10-29 212 mdev->ops->write_spad(mdev, MIC_DPLO_SPAD, mdev->dp_dma_addr);
c27a982e3ef142 Sherry Sun 2020-10-29 213 mdev->ops->write_spad(mdev, MIC_DPHI_SPAD, mdev->dp_dma_addr >> 32);
c27a982e3ef142 Sherry Sun 2020-10-29 214
3a6a9201897c64 Sudeep Dutt 2013-09-05 215 mic_bootparam_init(mdev);
3a6a9201897c64 Sudeep Dutt 2013-09-05 216 mic_create_debug_dir(mdev);
1da2b3eeef3667 Ashutosh Dixit 2015-09-29 217
1da2b3eeef3667 Ashutosh Dixit 2015-09-29 218 mdev->cosm_dev = cosm_register_device(&mdev->pdev->dev, &cosm_hw_ops);
1da2b3eeef3667 Ashutosh Dixit 2015-09-29 219 if (IS_ERR(mdev->cosm_dev)) {
1da2b3eeef3667 Ashutosh Dixit 2015-09-29 220 rc = PTR_ERR(mdev->cosm_dev);
1da2b3eeef3667 Ashutosh Dixit 2015-09-29 221 dev_err(&pdev->dev, "cosm_add_device failed rc %d\n", rc);
ef39830c358386 Sudeep Dutt 2016-02-08 222 goto cleanup_debug_dir;
1da2b3eeef3667 Ashutosh Dixit 2015-09-29 223 }
b170d8ce3f81bd Sudeep Dutt 2013-09-05 224 return 0;
f69bcbf3b4c4b3 Ashutosh Dixit 2013-09-05 225 cleanup_debug_dir:
f69bcbf3b4c4b3 Ashutosh Dixit 2013-09-05 226 mic_delete_debug_dir(mdev);
c27a982e3ef142 Sherry Sun 2020-10-29 227 dma_free_coherent(&pdev->dev, MIC_DP_SIZE, mdev->dp, mdev->dp_dma_addr);
a01e28f692088e Dasaratharaman Chandramouli 2013-09-05 228 smpt_uninit:
a01e28f692088e Dasaratharaman Chandramouli 2013-09-05 229 mic_smpt_uninit(mdev);
a01e28f692088e Dasaratharaman Chandramouli 2013-09-05 230 free_interrupts:
a01e28f692088e Dasaratharaman Chandramouli 2013-09-05 231 mic_free_interrupts(mdev, pdev);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 232 unmap_aper:
b170d8ce3f81bd Sudeep Dutt 2013-09-05 233 iounmap(mdev->aper.va);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 234 unmap_mmio:
b170d8ce3f81bd Sudeep Dutt 2013-09-05 235 iounmap(mdev->mmio.va);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 236 release_regions:
b170d8ce3f81bd Sudeep Dutt 2013-09-05 237 pci_release_regions(pdev);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 238 disable_device:
b170d8ce3f81bd Sudeep Dutt 2013-09-05 239 pci_disable_device(pdev);
1da2b3eeef3667 Ashutosh Dixit 2015-09-29 240 ida_remove:
b170d8ce3f81bd Sudeep Dutt 2013-09-05 241 ida_simple_remove(&g_mic_ida, mdev->id);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 242 ida_fail:
b170d8ce3f81bd Sudeep Dutt 2013-09-05 243 kfree(mdev);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 244 mdev_alloc_fail:
b170d8ce3f81bd Sudeep Dutt 2013-09-05 245 dev_err(&pdev->dev, "Probe failed rc %d\n", rc);
b170d8ce3f81bd Sudeep Dutt 2013-09-05 246 return rc;
b170d8ce3f81bd Sudeep Dutt 2013-09-05 247 }---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org