mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tobin C Harding <me@tobin.cc>
To: gregkh@linuxfoundation.org
Cc: arve@android.com, riandrews@android.com,
	linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	Tobin C Harding <me@tobin.cc>
Subject: [PATCH v2 4/4] drivers: staging: remove BUG_ON
Date: Mon, 18 Apr 2016 10:35:31 +1000	[thread overview]
Message-ID: <1460939731-7746-5-git-send-email-me@tobin.cc> (raw)
In-Reply-To: <1460939731-7746-1-git-send-email-me@tobin.cc>

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.

Signed-off-by: Tobin C Harding <me@tobin.cc>
---

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);
-- 
2.7.4

  parent reply	other threads:[~2016-04-18  0:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18  0:35 [PATCH v2 0/4] drivers: staging: checkpatch fixes Tobin C Harding
2016-04-18  0:35 ` [PATCH v2 1/4] drivers: staging: fix parameter alignment Tobin C Harding
2016-04-30  0:49   ` Greg KH
2016-04-18  0:35 ` [PATCH v2 2/4] drivers: staging: fix line length Tobin C Harding
2016-04-18  0:35 ` [PATCH v2 3/4] drivers: staging: remove comparison to NULL Tobin C Harding
2016-04-18  0:35 ` Tobin C Harding [this message]
2016-04-18 21:03   ` [PATCH v2 4/4] drivers: staging: remove BUG_ON Laura Abbott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460939731-7746-5-git-send-email-me@tobin.cc \
    --to=me@tobin.cc \
    --cc=arve@android.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riandrews@android.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome