Commit e4ff70a
cxl/acpi: Cleanup __cxl_parse_cfmws()
As a follow on to the recent rework of __cxl_parse_cfmws() to always
return errors [1], use cleanup.h helpers to remove goto and other cleanups
now that logging is moved to the cxl_parse_cfmws() wrapper.
This ends up adding more code than it deletes, but __cxl_parse_cfmws()
itself does get smaller. The takeaway from the cond_no_free_ptr()
discussion [2] was to not add new macros to handle the cases where
no_free_ptr() is awkward, instead rework the code to have helpers and
clearer delineation of responsibility.
Now one might say that __free(del_cxl_resource) is excessive given it
is immediately registered with add_or_reset_cxl_resource(). The
rationale for keeping it is that it forces use of "no_free_ptr()" on the
argument passed to add_or_reset_cxl_resource(). That in turn makes it
clear that @res is NULL for the rest of the function which is part of
the point of the cleanup helpers, to turn subtle use after free errors
[3] into loud NULL pointer de-references.
Link: http://lore.kernel.org/r/170820177238.631006.1012639681618409284.stgit@dwillia2-xfh.jf.intel.com [1]
Link: http://lore.kernel.org/r/CAHk-=whBVhnh=KSeBBRet=E7qJAwnPR_aj5em187Q3FiD+LXnA@mail.gmail.com [2]
Link: http://lore.kernel.org/r/20230714093146.2253438-1-leitao@debian.org [3]
Reported-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Closes: http://lore.kernel.org/r/20240219124041.00002bda@Huawei.com
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/171235474028.2718248.14109646123143505522.stgit@dwillia2-xfh.jf.intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>1 parent 1c987cf commit e4ff70a
2 files changed
Lines changed: 56 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
319 | 357 | | |
320 | 358 | | |
321 | 359 | | |
322 | 360 | | |
323 | 361 | | |
324 | | - | |
325 | 362 | | |
326 | | - | |
327 | 363 | | |
328 | 364 | | |
329 | 365 | | |
330 | 366 | | |
331 | | - | |
332 | 367 | | |
333 | 368 | | |
334 | 369 | | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
| 370 | + | |
339 | 371 | | |
340 | | - | |
341 | 372 | | |
342 | 373 | | |
343 | 374 | | |
| |||
348 | 379 | | |
349 | 380 | | |
350 | 381 | | |
351 | | - | |
| 382 | + | |
| 383 | + | |
352 | 384 | | |
353 | 385 | | |
354 | 386 | | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | 387 | | |
364 | | - | |
| 388 | + | |
365 | 389 | | |
366 | | - | |
| 390 | + | |
367 | 391 | | |
368 | 392 | | |
369 | 393 | | |
370 | 394 | | |
371 | 395 | | |
372 | 396 | | |
373 | | - | |
| 397 | + | |
| 398 | + | |
374 | 399 | | |
375 | 400 | | |
376 | 401 | | |
377 | 402 | | |
378 | 403 | | |
379 | 404 | | |
380 | 405 | | |
381 | | - | |
382 | | - | |
| 406 | + | |
| 407 | + | |
383 | 408 | | |
384 | 409 | | |
385 | 410 | | |
| |||
399 | 424 | | |
400 | 425 | | |
401 | 426 | | |
402 | | - | |
| 427 | + | |
403 | 428 | | |
404 | 429 | | |
405 | | - | |
406 | | - | |
| 430 | + | |
407 | 431 | | |
408 | 432 | | |
409 | 433 | | |
410 | 434 | | |
411 | 435 | | |
412 | 436 | | |
413 | 437 | | |
414 | | - | |
415 | 438 | | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
| 439 | + | |
| 440 | + | |
426 | 441 | | |
427 | 442 | | |
428 | 443 | | |
| |||
683 | 698 | | |
684 | 699 | | |
685 | 700 | | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | 701 | | |
693 | 702 | | |
694 | 703 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
781 | 781 | | |
782 | 782 | | |
783 | 783 | | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
784 | 789 | | |
785 | 790 | | |
786 | 791 | | |
| |||
0 commit comments