2022-01-12 08:54:11

by Yang Li

[permalink] [raw]
Subject: [PATCH -next] fanotify: remove variable set but not used

The code that uses the pointer info has been removed in
'https://lore.kernel.org/all/[email protected]/'
and fanotify_event_info() doesn't change 'event', so the declaration and
assignment of info can be removed.

Eliminate the following clang warning:
fs/notify/fanotify/fanotify_user.c:161:24: warning: variable ‘info’ set
but not used

Reported-by: Abaci Robot <[email protected]>
Signed-off-by: Yang Li <[email protected]>
---
fs/notify/fanotify/fanotify_user.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 73b1615f9d96..1026f67b1d1e 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -158,7 +158,6 @@ static size_t fanotify_event_len(unsigned int info_mode,
struct fanotify_event *event)
{
size_t event_len = FAN_EVENT_METADATA_LEN;
- struct fanotify_info *info;
int fh_len;
int dot_len = 0;

@@ -168,8 +167,6 @@ static size_t fanotify_event_len(unsigned int info_mode,
if (fanotify_is_error_event(event->mask))
event_len += FANOTIFY_ERROR_INFO_LEN;

- info = fanotify_event_info(event);
-
if (fanotify_event_has_any_dir_fh(event)) {
event_len += fanotify_dir_name_info_len(event);
} else if ((info_mode & FAN_REPORT_NAME) &&
--
2.20.1.7.g153144c



2022-01-21 22:03:08

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH -next] fanotify: remove variable set but not used

On Wed 12-01-22 16:54:03, Yang Li wrote:
> The code that uses the pointer info has been removed in
> 'https://lore.kernel.org/all/[email protected]/'
> and fanotify_event_info() doesn't change 'event', so the declaration and
> assignment of info can be removed.
>
> Eliminate the following clang warning:
> fs/notify/fanotify/fanotify_user.c:161:24: warning: variable ‘info’ set
> but not used
>
> Reported-by: Abaci Robot <[email protected]>
> Signed-off-by: Yang Li <[email protected]>

Thanks! I've added the patch to my tree.

Honza

> ---
> fs/notify/fanotify/fanotify_user.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
> index 73b1615f9d96..1026f67b1d1e 100644
> --- a/fs/notify/fanotify/fanotify_user.c
> +++ b/fs/notify/fanotify/fanotify_user.c
> @@ -158,7 +158,6 @@ static size_t fanotify_event_len(unsigned int info_mode,
> struct fanotify_event *event)
> {
> size_t event_len = FAN_EVENT_METADATA_LEN;
> - struct fanotify_info *info;
> int fh_len;
> int dot_len = 0;
>
> @@ -168,8 +167,6 @@ static size_t fanotify_event_len(unsigned int info_mode,
> if (fanotify_is_error_event(event->mask))
> event_len += FANOTIFY_ERROR_INFO_LEN;
>
> - info = fanotify_event_info(event);
> -
> if (fanotify_event_has_any_dir_fh(event)) {
> event_len += fanotify_dir_name_info_len(event);
> } else if ((info_mode & FAN_REPORT_NAME) &&
> --
> 2.20.1.7.g153144c
>
--
Jan Kara <[email protected]>
SUSE Labs, CR