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

Commit ec554f88 authored by Vinayak Menon's avatar Vinayak Menon
Browse files

ion: return proper error value on allocation failure



Return ENOMEM on allocation failure from ion_system_heap_allocate.
The absence of this was resulting in ion_buffer_create to proceed
further and thus causing a crash.

Change-Id: I906b129b5fe1c74f7176116142085fbb47c3c834
Signed-off-by: default avatarVinayak Menon <vinmenon@codeaurora.org>
parent 0b8903e1
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
 * drivers/staging/android/ion/ion_system_heap.c
 *
 * Copyright (C) 2011 Google, Inc.
 * Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2011-2019, The Linux Foundation. All rights reserved.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
@@ -331,8 +331,10 @@ static int ion_system_heap_allocate(struct ion_heap *heap,
		goto err;

	table = kzalloc(sizeof(*table), GFP_KERNEL);
	if (!table)
	if (!table) {
		ret = -ENOMEM;
		goto err_free_data_pages;
	}

	ret = sg_alloc_table(table, i, GFP_KERNEL);
	if (ret)