Commit a81ebe7
cxl/core: Use guard() to drop goto pattern of cxl_dpa_alloc()
In cxl_dpa_alloc(), some checking and operations need to be protected by
a rwsem called cxl_dpa_rwsem, so there is a goto pattern in
cxl_dpa_alloc() to release the rwsem. The goto pattern can be optimized
by using guard() to hold the rwsem.
Creating a new function called __cxl_dpa_alloc() to include all checking
and operations needed to be protected by cxl_dpa_rwsem. Using
guard(rwsem_write()) to hold cxl_dpa_rwsem at the beginning of the new
function.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Acked-by: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Li Ming <ming.li@zohomail.com>
Link: https://patch.msgid.link/20250221012453.126366-6-ming.li@zohomail.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>1 parent 16fe6ec commit a81ebe7
1 file changed
+14
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
445 | | - | |
| 445 | + | |
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
449 | | - | |
450 | 449 | | |
451 | 450 | | |
452 | 451 | | |
453 | 452 | | |
454 | | - | |
455 | 453 | | |
456 | | - | |
| 454 | + | |
457 | 455 | | |
458 | 456 | | |
459 | 457 | | |
460 | | - | |
461 | | - | |
| 458 | + | |
462 | 459 | | |
463 | 460 | | |
464 | 461 | | |
465 | 462 | | |
466 | | - | |
467 | | - | |
| 463 | + | |
468 | 464 | | |
469 | 465 | | |
470 | 466 | | |
| |||
504 | 500 | | |
505 | 501 | | |
506 | 502 | | |
507 | | - | |
508 | | - | |
| 503 | + | |
509 | 504 | | |
510 | 505 | | |
511 | 506 | | |
512 | 507 | | |
513 | 508 | | |
514 | | - | |
515 | | - | |
| 509 | + | |
516 | 510 | | |
517 | 511 | | |
518 | | - | |
519 | | - | |
520 | | - | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
521 | 519 | | |
| 520 | + | |
522 | 521 | | |
523 | 522 | | |
524 | 523 | | |
| |||
0 commit comments