2015-06-24 12:40:49

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH] kdbus: Delete an unnecessary check before the function call "kdbus_domain_unref"

From: Markus Elfring <[email protected]>
Date: Wed, 24 Jun 2015 14:30:17 +0200

The kdbus_domain_unref() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
---
ipc/kdbus/fs.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/ipc/kdbus/fs.c b/ipc/kdbus/fs.c
index d01f33b..205a3ad 100644
--- a/ipc/kdbus/fs.c
+++ b/ipc/kdbus/fs.c
@@ -325,9 +325,7 @@ static void fs_super_kill(struct super_block *sb)
}

kill_anon_super(sb);
-
- if (domain)
- kdbus_domain_unref(domain);
+ kdbus_domain_unref(domain);
}

static int fs_super_set(struct super_block *sb, void *data)
--
2.4.4


2015-06-24 12:45:17

by David Herrmann

[permalink] [raw]
Subject: Re: [PATCH] kdbus: Delete an unnecessary check before the function call "kdbus_domain_unref"

Hi

On Wed, Jun 24, 2015 at 2:40 PM, SF Markus Elfring
<[email protected]> wrote:
> From: Markus Elfring <[email protected]>
> Date: Wed, 24 Jun 2015 14:30:17 +0200
>
> The kdbus_domain_unref() function tests whether its argument is NULL
> and then returns immediately. Thus the test around the call is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <[email protected]>
> ---
> ipc/kdbus/fs.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/ipc/kdbus/fs.c b/ipc/kdbus/fs.c
> index d01f33b..205a3ad 100644
> --- a/ipc/kdbus/fs.c
> +++ b/ipc/kdbus/fs.c
> @@ -325,9 +325,7 @@ static void fs_super_kill(struct super_block *sb)
> }
>
> kill_anon_super(sb);
> -
> - if (domain)
> - kdbus_domain_unref(domain);
> + kdbus_domain_unref(domain);

Yeah, your patch is correct. The condition was kinda nice as it shows
the connection to the tear-down before the call to kill_anon_super().
But the function is simple enough for a reader to figure out
themselves.

Reviewed-by: David Herrmann <[email protected]>

Thanks
David

> }
>
> static int fs_super_set(struct super_block *sb, void *data)
> --
> 2.4.4
>

2015-06-24 12:46:00

by Djalal Harouni

[permalink] [raw]
Subject: Re: [PATCH] kdbus: Delete an unnecessary check before the function call "kdbus_domain_unref"

On Wed, Jun 24, 2015 at 02:40:11PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <[email protected]>
> Date: Wed, 24 Jun 2015 14:30:17 +0200
>
> The kdbus_domain_unref() function tests whether its argument is NULL
> and then returns immediately. Thus the test around the call is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <[email protected]>
> ---
> ipc/kdbus/fs.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/ipc/kdbus/fs.c b/ipc/kdbus/fs.c
> index d01f33b..205a3ad 100644
> --- a/ipc/kdbus/fs.c
> +++ b/ipc/kdbus/fs.c
> @@ -325,9 +325,7 @@ static void fs_super_kill(struct super_block *sb)
> }
>
> kill_anon_super(sb);
> -
> - if (domain)
> - kdbus_domain_unref(domain);
> + kdbus_domain_unref(domain);
> }
>
> static int fs_super_set(struct super_block *sb, void *data)
> --
> 2.4.4
>

Reviewed-by: Djalal Harouni <[email protected]>


--
Djalal Harouni
http://opendz.org

2015-07-06 18:42:57

by David Herrmann

[permalink] [raw]
Subject: Re: [PATCH] kdbus: Delete an unnecessary check before the function call "kdbus_domain_unref"

Hi

On Wed, Jun 24, 2015 at 2:40 PM, SF Markus Elfring
<[email protected]> wrote:
> From: Markus Elfring <[email protected]>
> Date: Wed, 24 Jun 2015 14:30:17 +0200
>
> The kdbus_domain_unref() function tests whether its argument is NULL
> and then returns immediately. Thus the test around the call is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <[email protected]>
> ---
> ipc/kdbus/fs.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)

Applied!

Thanks
David

> diff --git a/ipc/kdbus/fs.c b/ipc/kdbus/fs.c
> index d01f33b..205a3ad 100644
> --- a/ipc/kdbus/fs.c
> +++ b/ipc/kdbus/fs.c
> @@ -325,9 +325,7 @@ static void fs_super_kill(struct super_block *sb)
> }
>
> kill_anon_super(sb);
> -
> - if (domain)
> - kdbus_domain_unref(domain);
> + kdbus_domain_unref(domain);
> }
>
> static int fs_super_set(struct super_block *sb, void *data)
> --
> 2.4.4
>