cxlflash: Simplify attach path error cleanup
authorMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Fri, 4 Mar 2016 21:55:17 +0000 (15:55 -0600)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 9 Mar 2016 02:17:33 +0000 (21:17 -0500)
commit8a96b52af58721caf4f7496d0737e8ec6b63c86e
tree1fbc33e9d6aba5a27577a3d41da0aea6ff00adf1
parent5e6632d19ea2fafaec1b7c4cda7f7157ee8ad983
cxlflash: Simplify attach path error cleanup

The cxlflash_disk_attach() routine currently uses a cascading error
gate strategy for its error cleanup path. While this strategy is
commonly used to handle cleanup scenarios, it is too restrictive when
function callouts need to be restructured. Problems range from
inserting error path bugs in previously 'good' code to the cleanup
path imposing design changes to how the normal path is structured.
A less restrictive approach is needed to support ordering changes
that come about when operating in different environments.

To overcome this restriction, the error cleanup path is modified to
have a single entrypoint and use conditional logic to cleanup where
necessary. Entities that require multiple cleanup steps must be
carefully vetted to ensure their APIs support state. In cases where
they do not (none as of this commit) additional local variables can
be used to maintain state on their behalf.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/cxlflash/superpipe.c