On Mon, Aug 22, 2016 at 04:34:37PM +0800, Shawn Lin wrote:
> Let's free utlbs for the error routine.
> 
> Signed-off-by: Shawn Lin <[email protected]>
> ---
> 
>  drivers/iommu/ipmmu-vmsa.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
> index 2fdbac6..2458208 100644
> --- a/drivers/iommu/ipmmu-vmsa.c
> +++ b/drivers/iommu/ipmmu-vmsa.c
> @@ -635,8 +635,10 @@ static int ipmmu_add_device(struct device *dev)
>  
>       spin_unlock(&ipmmu_devices_lock);
>  
> -     if (ret < 0)
> +     if (ret < 0) {
> +             kfree(utlbs);
>               return -ENODEV;
> +     }

This function has an error-out path that you can use here. This will
also correctply propagate the ret-value to the callers.



        Joerg
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to