On Tue, 23 Sep 2025 10:40:12 -0700
Dave Jiang <[email protected]> wrote:

> Converting nvdimm_bus_lock/unlock to guard() to clean up usage
> of gotos for error handling and avoid future mistakes of missed
> unlock on error paths.
> 
> Link: https://lore.kernel.org/linux-cxl/[email protected]/
> Suggested-by: Jonathan Cameron <[email protected]>
> Signed-off-by: Dave Jiang <[email protected]>
Nice.

I still wince a little the places where sharing a dev_dbg()
leads to more complex code flow that we'd otherwise have, but that
is probably not worth the effort of cleaning up further.

Reviewed-by: Jonathan Cameron <[email protected]>

> ---
> v2:
> - Moved cleanup of __nd_ioctl() cleanup to a different patch. (Dan)
> - Various minor fixes and cleanups. (Jonathan)
> ---
>  drivers/nvdimm/badrange.c       |   3 +-
>  drivers/nvdimm/btt_devs.c       |  24 +++----
>  drivers/nvdimm/bus.c            |   6 +-
>  drivers/nvdimm/claim.c          |   7 +-
>  drivers/nvdimm/core.c           |  17 +++--
>  drivers/nvdimm/dax_devs.c       |  12 ++--
>  drivers/nvdimm/dimm.c           |   5 +-
>  drivers/nvdimm/dimm_devs.c      |  48 +++++--------
>  drivers/nvdimm/namespace_devs.c | 117 +++++++++++++++----------------
>  drivers/nvdimm/nd.h             |   3 +
>  drivers/nvdimm/pfn_devs.c       |  61 +++++++----------
>  drivers/nvdimm/region.c         |  14 ++--
>  drivers/nvdimm/region_devs.c    | 118 ++++++++++++++------------------
>  drivers/nvdimm/security.c       |  10 +--
>  14 files changed, 194 insertions(+), 251 deletions(-)


Reply via email to