Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 6d515ec7 authored by Sudarshan Rajagopalan's avatar Sudarshan Rajagopalan
Browse files

iommu: arm-smmu: fix check for need for preallocate memory



commit b312b4f0 ("iommu: arm-smmu: Preallocate memory for map
only on failure") had the following two errors:

  1. The return code we checking when map_sg fails and we preallocte
     is wrong. The check should be for 0 and not -ENOMEM.
     So the preallocate is never happening when map_sg fails.

  2. map_sg could've have mapped certain elements in sglist and later
     had got failed. With proper check, we are trying to call map_sg
     on the same size again, which would leave to double map of
     previously mapped elements in sglist.

Fix this by returning the actual ret code from arm_lpae_map_sg()
and check it against -ENOMEM if we need to preallocate or not.
Also, unmap any partial iovas that was mapped previously.

Change-Id: Ifee7c0bed6b9cf1c35ebb4a03d51a1a80ab0ed58
Signed-off-by: default avatarSudarshan Rajagopalan <sudaraja@codeaurora.org>
parent 4cb71ce2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment