public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Potentially missing "else"
@ 2013-08-07 21:58 Jan Engelhardt
  2013-08-07 21:58 ` [PATCH] depmod: add missing "else" clause Jan Engelhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Engelhardt @ 2013-08-07 21:58 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: linux-kernel


The following changes since commit 48a409644199d5efff6d966cd72ccc7f5a06c2a5:

  shell-completion: Make options accept '=' as last char (2013-08-02 12:07:39 -0300)

are available in the git repository at:

  git://git.inai.de/kmod master

for you to fetch changes up to e4523541e7f26457cf7078d5f30e091d1b24e3a9:

  depmod: add missing "else" clause (2013-08-07 23:50:51 +0200)

----------------------------------------------------------------
Jan Engelhardt (1):
      depmod: add missing "else" clause

 libkmod/libkmod-config.c | 2 +-
 tools/depmod.c           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] depmod: add missing "else" clause
  2013-08-07 21:58 Potentially missing "else" Jan Engelhardt
@ 2013-08-07 21:58 ` Jan Engelhardt
  2013-08-09 15:03   ` Lucas De Marchi
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Engelhardt @ 2013-08-07 21:58 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: linux-kernel

It occurred to an openSUSE user that our mkinitrd would throw a
warning when used with kmod:

libkmod: conf_files_list: unsupported file mode /dev/null: 0x21b6

Grepping for the error message revealed that there might be a missing
"else" keyword here, since it is unusual to put an "if" directly after
closing brace.
---
 libkmod/libkmod-config.c | 2 +-
 tools/depmod.c           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
index 201c349..cb4cf61 100644
--- a/libkmod/libkmod-config.c
+++ b/libkmod/libkmod-config.c
@@ -833,7 +833,7 @@ static int conf_files_list(struct kmod_ctx *ctx, struct kmod_list **list,
 	if (S_ISREG(st.st_mode)) {
 		conf_files_insert_sorted(ctx, list, path, NULL);
 		return 0;
-	} if (!S_ISDIR(st.st_mode)) {
+	} else if (!S_ISDIR(st.st_mode)) {
 		ERR(ctx, "unsupported file mode %s: %#x\n",
 							path, st.st_mode);
 		return -EINVAL;
diff --git a/tools/depmod.c b/tools/depmod.c
index 4a02631..985cf3a 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -848,7 +848,7 @@ static int cfg_files_list(struct cfg_file ***p_files, size_t *p_n_files,
 	if (S_ISREG(st.st_mode)) {
 		cfg_files_insert_sorted(p_files, p_n_files, path, NULL);
 		return 0;
-	} if (!S_ISDIR(st.st_mode)) {
+	} else if (!S_ISDIR(st.st_mode)) {
 		ERR("unsupported file mode %s: %#x\n", path, st.st_mode);
 		return -EINVAL;
 	}
-- 
1.8.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] depmod: add missing "else" clause
  2013-08-07 21:58 ` [PATCH] depmod: add missing "else" clause Jan Engelhardt
@ 2013-08-09 15:03   ` Lucas De Marchi
  2013-08-09 18:27     ` H. Peter Anvin
  0 siblings, 1 reply; 4+ messages in thread
From: Lucas De Marchi @ 2013-08-09 15:03 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Lucas De Marchi, lkml, linux-modules

Hi Jan,


On Wed, Aug 7, 2013 at 6:58 PM, Jan Engelhardt <jengelh@inai.de> wrote:
>
> It occurred to an openSUSE user that our mkinitrd would throw a
> warning when used with kmod:
>
> libkmod: conf_files_list: unsupported file mode /dev/null: 0x21b6
>
> Grepping for the error message revealed that there might be a missing
> "else" keyword here, since it is unusual to put an "if" directly after
> closing brace.
> ---
>  libkmod/libkmod-config.c | 2 +-
>  tools/depmod.c           | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
> index 201c349..cb4cf61 100644
> --- a/libkmod/libkmod-config.c
> +++ b/libkmod/libkmod-config.c
> @@ -833,7 +833,7 @@ static int conf_files_list(struct kmod_ctx *ctx, struct kmod_list **list,
>         if (S_ISREG(st.st_mode)) {
>                 conf_files_insert_sorted(ctx, list, path, NULL);
>                 return 0;
> -       } if (!S_ISDIR(st.st_mode)) {
> +       } else if (!S_ISDIR(st.st_mode)) {
>                 ERR(ctx, "unsupported file mode %s: %#x\n",
>                                                         path, st.st_mode);
>                 return -EINVAL;
> diff --git a/tools/depmod.c b/tools/depmod.c
> index 4a02631..985cf3a 100644
> --- a/tools/depmod.c
> +++ b/tools/depmod.c
> @@ -848,7 +848,7 @@ static int cfg_files_list(struct cfg_file ***p_files, size_t *p_n_files,
>         if (S_ISREG(st.st_mode)) {
>                 cfg_files_insert_sorted(p_files, p_n_files, path, NULL);
>                 return 0;
> -       } if (!S_ISDIR(st.st_mode)) {
> +       } else if (!S_ISDIR(st.st_mode)) {
>                 ERR("unsupported file mode %s: %#x\n", path, st.st_mode);
>                 return -EINVAL;
>         }
> --

Applied, thanks.

Please make sure to CC linux-modules@vger.kernel.org


Lucas De Marchi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] depmod: add missing "else" clause
  2013-08-09 15:03   ` Lucas De Marchi
@ 2013-08-09 18:27     ` H. Peter Anvin
  0 siblings, 0 replies; 4+ messages in thread
From: H. Peter Anvin @ 2013-08-09 18:27 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: Jan Engelhardt, Lucas De Marchi, lkml, linux-modules

On 08/09/2013 08:03 AM, Lucas De Marchi wrote:
> Hi Jan,
> 
> 
> On Wed, Aug 7, 2013 at 6:58 PM, Jan Engelhardt <jengelh@inai.de> wrote:
>>
>> It occurred to an openSUSE user that our mkinitrd would throw a
>> warning when used with kmod:
>>
>> libkmod: conf_files_list: unsupported file mode /dev/null: 0x21b6
>>
>> Grepping for the error message revealed that there might be a missing
>> "else" keyword here, since it is unusual to put an "if" directly after
>> closing brace.
>> ---
>>  libkmod/libkmod-config.c | 2 +-
>>  tools/depmod.c           | 2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
>> index 201c349..cb4cf61 100644
>> --- a/libkmod/libkmod-config.c
>> +++ b/libkmod/libkmod-config.c
>> @@ -833,7 +833,7 @@ static int conf_files_list(struct kmod_ctx *ctx, struct kmod_list **list,
>>         if (S_ISREG(st.st_mode)) {
>>                 conf_files_insert_sorted(ctx, list, path, NULL);
>>                 return 0;
>> -       } if (!S_ISDIR(st.st_mode)) {
>> +       } else if (!S_ISDIR(st.st_mode)) {
>>                 ERR(ctx, "unsupported file mode %s: %#x\n",
>>                                                         path, st.st_mode);
>>                 return -EINVAL;
>> diff --git a/tools/depmod.c b/tools/depmod.c
>> index 4a02631..985cf3a 100644
>> --- a/tools/depmod.c
>> +++ b/tools/depmod.c
>> @@ -848,7 +848,7 @@ static int cfg_files_list(struct cfg_file ***p_files, size_t *p_n_files,
>>         if (S_ISREG(st.st_mode)) {
>>                 cfg_files_insert_sorted(p_files, p_n_files, path, NULL);
>>                 return 0;
>> -       } if (!S_ISDIR(st.st_mode)) {
>> +       } else if (!S_ISDIR(st.st_mode)) {
>>                 ERR("unsupported file mode %s: %#x\n", path, st.st_mode);
>>                 return -EINVAL;
>>         }
>> --
> 
> Applied, thanks.
> 
> Please make sure to CC linux-modules@vger.kernel.org
> 

Also please note that this is a stylistic change only, since the
previous if clause ends with a return.

	-hpa



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-09 18:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-07 21:58 Potentially missing "else" Jan Engelhardt
2013-08-07 21:58 ` [PATCH] depmod: add missing "else" clause Jan Engelhardt
2013-08-09 15:03   ` Lucas De Marchi
2013-08-09 18:27     ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox