drivers/pci/doe.c:313 doe_statemachine_work() warn: inconsistent returns '&pdev->reset_lock'.
PATCH 3/3 drivers/pci/doe.c:313 doe_statemachine_work() warn: inconsistent returns '&pdev->reset_lock'.
tree: https://github.com/l1k/linux pciehp_deadlock_v2_attempt_per_dev_rwsem head: 1fd5c4fbe98942fb0a686f116616b8f3098e2680 commit: 1fd5c4fbe98942fb0a686f116616b8f3098e2680 [3/3] PCI/DOE: Protect DOE exchanges against concurrent reset. config: i386-randconfig-m021 (https://download.01.org/0day-ci/archive/20230122/[email protected]/config) compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
smatch warnings:drivers/pci/doe.c:313 doe_statemachine_work() warn: inconsistent returns '&pdev->reset_lock'.
vim +313 drivers/pci/doe.c
9d24322e887b6a Jonathan Cameron 2022-07-19 250 static void doe_statemachine_work(struct work_struct *work)
9d24322e887b6a Jonathan Cameron 2022-07-19 251 {
9d24322e887b6a Jonathan Cameron 2022-07-19 252 struct pci_doe_task *task = container_of(work, struct pci_doe_task,
9d24322e887b6a Jonathan Cameron 2022-07-19 253 work);
9d24322e887b6a Jonathan Cameron 2022-07-19 254 struct pci_doe_mb *doe_mb = task->doe_mb;
9d24322e887b6a Jonathan Cameron 2022-07-19 255 struct pci_dev *pdev = doe_mb->pdev;
9d24322e887b6a Jonathan Cameron 2022-07-19 256 int offset = doe_mb->cap_offset;
9d24322e887b6a Jonathan Cameron 2022-07-19 257 unsigned long timeout_jiffies;
9d24322e887b6a Jonathan Cameron 2022-07-19 258 u32 val;
9d24322e887b6a Jonathan Cameron 2022-07-19 259 int rc;
9d24322e887b6a Jonathan Cameron 2022-07-19 260
9d24322e887b6a Jonathan Cameron 2022-07-19 261 if (test_bit(PCI_DOE_FLAG_DEAD, &doe_mb->flags)) {
9d24322e887b6a Jonathan Cameron 2022-07-19 262 signal_task_complete(task, -EIO);
9d24322e887b6a Jonathan Cameron 2022-07-19 263 return;
9d24322e887b6a Jonathan Cameron 2022-07-19 264 }
9d24322e887b6a Jonathan Cameron 2022-07-19 265
1fd5c4fbe98942 Lukas Wunner 2023-01-21 266 down_read(&pdev->reset_lock);
1fd5c4fbe98942 Lukas Wunner 2023-01-21 267
9d24322e887b6a Jonathan Cameron 2022-07-19 268 /* Send request */
9d24322e887b6a Jonathan Cameron 2022-07-19 269 rc = pci_doe_send_req(doe_mb, task);
9d24322e887b6a Jonathan Cameron 2022-07-19 270 if (rc) {
9d24322e887b6a Jonathan Cameron 2022-07-19 271 /*
9d24322e887b6a Jonathan Cameron 2022-07-19 272 * The specification does not provide any guidance on how to
9d24322e887b6a Jonathan Cameron 2022-07-19 273 * resolve conflicting requests from other entities.
9d24322e887b6a Jonathan Cameron 2022-07-19 274 * Furthermore, it is likely that busy will not be detected
9d24322e887b6a Jonathan Cameron 2022-07-19 275 * most of the time. Flag any detection of status busy with an
9d24322e887b6a Jonathan Cameron 2022-07-19 276 * error.
9d24322e887b6a Jonathan Cameron 2022-07-19 277 */
9d24322e887b6a Jonathan Cameron 2022-07-19 278 if (rc == -EBUSY)
9d24322e887b6a Jonathan Cameron 2022-07-19 279 dev_err_ratelimited(&pdev->dev, "[%x] busy detected; another entity is sending conflicting requests\n",
9d24322e887b6a Jonathan Cameron 2022-07-19 280 offset);
9d24322e887b6a Jonathan Cameron 2022-07-19 281 signal_task_abort(task, rc);
9d24322e887b6a Jonathan Cameron 2022-07-19 282 return;Needs to drop the lock before returning
9d24322e887b6a Jonathan Cameron 2022-07-19 283 }
9d24322e887b6a Jonathan Cameron 2022-07-19 284
9d24322e887b6a Jonathan Cameron 2022-07-19 285 timeout_jiffies = jiffies + PCI_DOE_TIMEOUT;
9d24322e887b6a Jonathan Cameron 2022-07-19 286 /* Poll for response */
9d24322e887b6a Jonathan Cameron 2022-07-19 287 retry_resp:
9d24322e887b6a Jonathan Cameron 2022-07-19 288 pci_read_config_dword(pdev, offset + PCI_DOE_STATUS, &val);
9d24322e887b6a Jonathan Cameron 2022-07-19 289 if (FIELD_GET(PCI_DOE_STATUS_ERROR, val)) {
9d24322e887b6a Jonathan Cameron 2022-07-19 290 signal_task_abort(task, -EIO);
9d24322e887b6a Jonathan Cameron 2022-07-19 291 return;Same
9d24322e887b6a Jonathan Cameron 2022-07-19 292 }
9d24322e887b6a Jonathan Cameron 2022-07-19 293
9d24322e887b6a Jonathan Cameron 2022-07-19 294 if (!FIELD_GET(PCI_DOE_STATUS_DATA_OBJECT_READY, val)) {
9d24322e887b6a Jonathan Cameron 2022-07-19 295 if (time_after(jiffies, timeout_jiffies)) {
9d24322e887b6a Jonathan Cameron 2022-07-19 296 signal_task_abort(task, -EIO);
9d24322e887b6a Jonathan Cameron 2022-07-19 297 return;Same
9d24322e887b6a Jonathan Cameron 2022-07-19 298 }
9d24322e887b6a Jonathan Cameron 2022-07-19 299 rc = pci_doe_wait(doe_mb, PCI_DOE_POLL_INTERVAL);
9d24322e887b6a Jonathan Cameron 2022-07-19 300 if (rc) {
9d24322e887b6a Jonathan Cameron 2022-07-19 301 signal_task_abort(task, rc);
9d24322e887b6a Jonathan Cameron 2022-07-19 302 return;Same
9d24322e887b6a Jonathan Cameron 2022-07-19 303 }
9d24322e887b6a Jonathan Cameron 2022-07-19 304 goto retry_resp;
9d24322e887b6a Jonathan Cameron 2022-07-19 305 }
9d24322e887b6a Jonathan Cameron 2022-07-19 306
9d24322e887b6a Jonathan Cameron 2022-07-19 307 rc = pci_doe_recv_resp(doe_mb, task);
9d24322e887b6a Jonathan Cameron 2022-07-19 308 if (rc < 0) {
9d24322e887b6a Jonathan Cameron 2022-07-19 309 signal_task_abort(task, rc);
9d24322e887b6a Jonathan Cameron 2022-07-19 310 return;Same
9d24322e887b6a Jonathan Cameron 2022-07-19 311 }9d24322e887b6a Jonathan Cameron 2022-07-19 3129d24322e887b6a Jonathan Cameron 2022-07-19 @313 signal_task_complete(task, rc);9d24322e887b6a Jonathan Cameron 2022-07-19 314 }
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests