2015-06-23 23:42:28

by Fengguang Wu

[permalink] [raw]
Subject: [PATCH] sysfs: fix simple_return.cocci warnings

security/smack/smackfs.c:2251:1-4: WARNING: end returns can be simpified and declaration on line 2250 can be dropped

Simplify a trivial if-return sequence. Possibly combine with a
preceding function call.

Generated by: scripts/coccinelle/misc/simple_return.cocci

Signed-off-by: Fengguang Wu <[email protected]>
---

smackfs.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -2247,11 +2247,7 @@ static const struct file_operations smk_
*/
static int smk_init_sysfs(void)
{
- int err;
- err = sysfs_create_mount_point(fs_kobj, "smackfs");
- if (err)
- return err;
- return 0;
+ return sysfs_create_mount_point(fs_kobj, "smackfs");
}

/**


2015-06-25 13:13:36

by Serge E. Hallyn

[permalink] [raw]
Subject: Re: [PATCH] sysfs: fix simple_return.cocci warnings

On Wed, Jun 24, 2015 at 07:41:07AM +0800, kbuild test robot wrote:
> security/smack/smackfs.c:2251:1-4: WARNING: end returns can be simpified and declaration on line 2250 can be dropped
>
> Simplify a trivial if-return sequence. Possibly combine with a
> preceding function call.
>
> Generated by: scripts/coccinelle/misc/simple_return.cocci
>
> Signed-off-by: Fengguang Wu <[email protected]>

Acked-by: Serge Hallyn <[email protected]>

> ---
>
> smackfs.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> --- a/security/smack/smackfs.c
> +++ b/security/smack/smackfs.c
> @@ -2247,11 +2247,7 @@ static const struct file_operations smk_
> */
> static int smk_init_sysfs(void)
> {
> - int err;
> - err = sysfs_create_mount_point(fs_kobj, "smackfs");
> - if (err)
> - return err;
> - return 0;
> + return sysfs_create_mount_point(fs_kobj, "smackfs");
> }
>
> /**

2015-07-22 19:37:47

by Casey Schaufler

[permalink] [raw]
Subject: Re: [PATCH] sysfs: fix simple_return.cocci warnings

On 6/23/2015 4:41 PM, kbuild test robot wrote:
> security/smack/smackfs.c:2251:1-4: WARNING: end returns can be simpified and declaration on line 2250 can be dropped
>
> Simplify a trivial if-return sequence. Possibly combine with a
> preceding function call.
>
> Generated by: scripts/coccinelle/misc/simple_return.cocci
>
> Signed-off-by: Fengguang Wu <[email protected]>

Acked-by: Casey Schaufler <[email protected]>

Applied to https://github.com/cschaufler/smack-next.git#smack-for-4.3

> ---
>
> smackfs.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> --- a/security/smack/smackfs.c
> +++ b/security/smack/smackfs.c
> @@ -2247,11 +2247,7 @@ static const struct file_operations smk_
> */
> static int smk_init_sysfs(void)
> {
> - int err;
> - err = sysfs_create_mount_point(fs_kobj, "smackfs");
> - if (err)
> - return err;
> - return 0;
> + return sysfs_create_mount_point(fs_kobj, "smackfs");
> }
>
> /**
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>