From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752027AbcFFSXo (ORCPT ); Mon, 6 Jun 2016 14:23:44 -0400 Received: from mail-qg0-f46.google.com ([209.85.192.46]:36219 "EHLO mail-qg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751174AbcFFSXm (ORCPT ); Mon, 6 Jun 2016 14:23:42 -0400 From: Laura Abbott To: Sumit Semwal , John Stultz , =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Riley Andrews Cc: Laura Abbott , Daniel Vetter , linaro-mm-sig@lists.linaro.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Eun Taik Lee , Liviu Dudau , Jon Medhurst , Mitchel Humpherys , Jeremy Gebben , Bryan Huntsman , Greg Kroah-Hartman , Android Kernel Team , Laura Abbott Subject: [RFC][PATCH 1/6] staging: android: ion: return error value for ion_device_add_heap Date: Mon, 6 Jun 2016 11:23:28 -0700 Message-Id: <1465237413-10549-2-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465237413-10549-1-git-send-email-labbott@redhat.com> References: <1465237413-10549-1-git-send-email-labbott@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Laura Abbott ion_device_add_heap doesn't return an error value. Change it to return information to callers. Signed-off-by: Laura Abbott --- drivers/staging/android/ion/ion.c | 7 +++++-- drivers/staging/android/ion/ion_priv.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index a2cf93b..306340a 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -1584,14 +1584,16 @@ static int debug_shrink_get(void *data, u64 *val) DEFINE_SIMPLE_ATTRIBUTE(debug_shrink_fops, debug_shrink_get, debug_shrink_set, "%llu\n"); -void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap) +int ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap) { struct dentry *debug_file; if (!heap->ops->allocate || !heap->ops->free || !heap->ops->map_dma || - !heap->ops->unmap_dma) + !heap->ops->unmap_dma) { pr_err("%s: can not add heap with invalid ops struct.\n", __func__); + return -EINVAL; + } spin_lock_init(&heap->free_lock); heap->free_list_size = 0; @@ -1639,6 +1641,7 @@ void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap) } up_write(&dev->lock); + return 0; } EXPORT_SYMBOL(ion_device_add_heap); diff --git a/drivers/staging/android/ion/ion_priv.h b/drivers/staging/android/ion/ion_priv.h index 0239883..35726ae 100644 --- a/drivers/staging/android/ion/ion_priv.h +++ b/drivers/staging/android/ion/ion_priv.h @@ -221,7 +221,7 @@ void ion_device_destroy(struct ion_device *dev); * @dev: the device * @heap: the heap to add */ -void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap); +int ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap); /** * some helpers for common operations on buffers using the sg_table -- 2.5.5