Skip to content
Commit c9c93b00 authored by Carl Worth's avatar Carl Worth Committed by James Morse
Browse files

mpam: Cleanup error handling in mpam_msc_drv_probe



Prior to this commit, some error cases in this function would leave
data in an inconsistent state. Most notably, any errors after the
do/while block would leave the newly-added msc on the global list, but
this msc would be freed by the platform_device error-handling code
paths, leaving a corrupt list and problems down the road.

Additionally, earlier error paths in this function were inconsistent
both about whether msc was immediately freed and whether after being
freed it was set to an error value. Finally, other cleanup, such as
cleaning up any mpam_msc_ris objects was never previously done.

These issues are addressed in this commit by consolidating all cleanup
into a single block at the end of the function, and reordering the
initialization so that keying off of a non-NULL msc is sufficient to
determine that all the cleanup code should be executed.

Signed-off-by: default avatarCarl Worth <carl@os.amperecomputing.com>
[ morse: dropped unneeded srcu call, moved over to garbage code ]
Signed-off-by: James Morse's avatarJames Morse <james.morse@arm.com>
parent 13ff1b52
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment