From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752011AbcDRVDP (ORCPT ); Mon, 18 Apr 2016 17:03:15 -0400 Received: from mail-qg0-f54.google.com ([209.85.192.54]:34922 "EHLO mail-qg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751164AbcDRVDN (ORCPT ); Mon, 18 Apr 2016 17:03:13 -0400 Subject: Re: [PATCH v2 4/4] drivers: staging: remove BUG_ON To: Tobin C Harding , gregkh@linuxfoundation.org References: <1460939731-7746-1-git-send-email-me@tobin.cc> <1460939731-7746-5-git-send-email-me@tobin.cc> Cc: arve@android.com, riandrews@android.com, linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org From: Laura Abbott Message-ID: <57154B8C.5000302@redhat.com> Date: Mon, 18 Apr 2016 14:03:08 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <1460939731-7746-5-git-send-email-me@tobin.cc> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/17/2016 05:35 PM, Tobin C Harding wrote: > drivers/staging/android/ion/ion.c calls BUG_ON in places where WARN_ON will > suffice. > > This patch replaces two such occurences. Two other occurences remain. > You got the logic flow correct but I'd prefer to keep the BUG_ON. It's catching actual bugs in the framework. > Signed-off-by: Tobin C Harding > --- > > Changing the remaining two BUG_ON's causes changes to the programm logic. > > This is my first patch set to the kernel, I am as such, not comfortable > changeing the logic of this file at this early stage of the game. :) > > drivers/staging/android/ion/ion.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c > index 234848f..1e37f52 100644 > --- a/drivers/staging/android/ion/ion.c > +++ b/drivers/staging/android/ion/ion.c > @@ -325,7 +325,7 @@ static void ion_buffer_remove_from_handle(struct ion_buffer *buffer) > */ > mutex_lock(&buffer->lock); > buffer->handle_count--; > - BUG_ON(buffer->handle_count < 0); > + WARN_ON(buffer->handle_count < 0); > if (!buffer->handle_count) { > struct task_struct *task; > > @@ -556,7 +556,10 @@ static void ion_free_nolock(struct ion_client *client, > { > bool valid_handle; > > - BUG_ON(client != handle->client); > + if (client != handle->client) { > + WARN(1, "%s: client != handle->client.\n", __func__); > + return; > + } > > valid_handle = ion_handle_validate(client, handle); > > @@ -569,7 +572,10 @@ static void ion_free_nolock(struct ion_client *client, > > void ion_free(struct ion_client *client, struct ion_handle *handle) > { > - BUG_ON(client != handle->client); > + if (client != handle->client) { > + WARN(1, "%s: client != handle->client.\n", __func__); > + return; > + } > > mutex_lock(&client->lock); > ion_free_nolock(client, handle); >