Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1380873 > unrolled thread

[PATCH v2 4/4] drivers: staging: remove BUG_ON

Started byTobin C Harding <me@tobin.cc>
First post2016-04-18 02:40 +0200
Last post2016-04-18 23:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 4/4] drivers: staging: remove BUG_ON Tobin C Harding <me@tobin.cc> - 2016-04-18 02:40 +0200
    Re: [PATCH v2 4/4] drivers: staging: remove BUG_ON Laura Abbott <labbott@redhat.com> - 2016-04-18 23:10 +0200

#1380873 — [PATCH v2 4/4] drivers: staging: remove BUG_ON

FromTobin C Harding <me@tobin.cc>
Date2016-04-18 02:40 +0200
Subject[PATCH v2 4/4] drivers: staging: remove BUG_ON
Message-ID<rp5ol-4yK-15@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1382049

FromLaura Abbott <labbott@redhat.com>
Date2016-04-18 23:10 +0200
Message-ID<rpoAO-3RI-167@gated-at.bofh.it>
In reply to#1380873
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 <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);
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web