mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sound: Fix warnings relating to ignored return value in snd_card_register
@ 2008-11-18 15:59 Hannes Eder
  2008-11-18 16:14 ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Hannes Eder @ 2008-11-18 15:59 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, kernel-janitors, linux-kernel

Do not ignore the return of 'device_create_file' in
'snd_card_register' and thereby fixing the following warnings:

sound/core/init.c: In function 'snd_card_register':
sound/core/init.c:640: warning: ignoring return value of
'device_create_file', declared with attribute warn_unused_result
sound/core/init.c:641: warning: ignoring return value of
'device_create_file', declared with attribute warn_unused_result

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
 sound/core/init.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/sound/core/init.c b/sound/core/init.c
index af1e407..814d834 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -637,8 +637,10 @@ int snd_card_register(struct snd_card *card)
 #endif
 #ifndef CONFIG_SYSFS_DEPRECATED
 	if (card->card_dev) {
-		device_create_file(card->card_dev, &card_id_attrs);
-		device_create_file(card->card_dev, &card_number_attrs);
+		if ((err = device_create_file(card->card_dev, &card_id_attrs)) < 0)
+			return err;
+		if ((err = device_create_file(card->card_dev, &card_number_attrs)) < 0)
+			return err;
 	}
 #endif
 	return 0;

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

* Re: [PATCH] sound: Fix warnings relating to ignored return value in snd_card_register
  2008-11-18 15:59 [PATCH] sound: Fix warnings relating to ignored return value in snd_card_register Hannes Eder
@ 2008-11-18 16:14 ` Takashi Iwai
  2008-11-18 17:06   ` Hannes Eder
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2008-11-18 16:14 UTC (permalink / raw)
  To: Hannes Eder; +Cc: Jaroslav Kysela, kernel-janitors, linux-kernel

At Tue, 18 Nov 2008 16:59:03 +0100,
Hannes Eder wrote:
> 
> Do not ignore the return of 'device_create_file' in
> 'snd_card_register' and thereby fixing the following warnings:
> 
> sound/core/init.c: In function 'snd_card_register':
> sound/core/init.c:640: warning: ignoring return value of
> 'device_create_file', declared with attribute warn_unused_result
> sound/core/init.c:641: warning: ignoring return value of
> 'device_create_file', declared with attribute warn_unused_result

The changes look good, but please run checkpatch.pl to your patch and
fix the coding style issues suggested there.


thanks,

Takashi

> 
> Signed-off-by: Hannes Eder <hannes@hanneseder.net>
> ---
>  sound/core/init.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/core/init.c b/sound/core/init.c
> index af1e407..814d834 100644
> --- a/sound/core/init.c
> +++ b/sound/core/init.c
> @@ -637,8 +637,10 @@ int snd_card_register(struct snd_card *card)
>  #endif
>  #ifndef CONFIG_SYSFS_DEPRECATED
>  	if (card->card_dev) {
> -		device_create_file(card->card_dev, &card_id_attrs);
> -		device_create_file(card->card_dev, &card_number_attrs);
> +		if ((err = device_create_file(card->card_dev, &card_id_attrs)) < 0)
> +			return err;
> +		if ((err = device_create_file(card->card_dev, &card_number_attrs)) < 0)
> +			return err;
>  	}
>  #endif
>  	return 0;
> 

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

* Re: [PATCH] sound: Fix warnings relating to ignored return value in snd_card_register
  2008-11-18 16:14 ` Takashi Iwai
@ 2008-11-18 17:06   ` Hannes Eder
  2008-11-18 17:12     ` Richard Holden
  2008-11-18 17:12     ` Takashi Iwai
  0 siblings, 2 replies; 7+ messages in thread
From: Hannes Eder @ 2008-11-18 17:06 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Jaroslav Kysela, kernel-janitors, linux-kernel

Do not ignore the return of 'device_create_file' in
'snd_card_register' and thereby fixing the following warnings:

sound/core/init.c: In function 'snd_card_register':
sound/core/init.c:640: warning: ignoring return value of
'device_create_file', declared with attribute warn_unused_result
sound/core/init.c:641: warning: ignoring return value of
'device_create_file', declared with attribute warn_unused_result

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---

On Tue, Nov 18, 2008 at 11:14 AM, Takashi Iwai <tiwai@suse.de> wrote:
> The changes look good, but please run checkpatch.pl to your patch and
> fix the coding style issues suggested there.

I did not fix:

"WARNING: line over 80 characters" as they a hardly longer than 80
characters and there are lines longer than this in the same file.

"ERROR: do not use assignment in if condition" as this pattern seems
to be quite common.

Comments? Should I fix them?

 sound/core/init.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/sound/core/init.c b/sound/core/init.c
index af1e407..814d834 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -637,8 +637,10 @@ int snd_card_register(struct snd_card *card)
 #endif
 #ifndef CONFIG_SYSFS_DEPRECATED
 	if (card->card_dev) {
-		device_create_file(card->card_dev, &card_id_attrs);
-		device_create_file(card->card_dev, &card_number_attrs);
+		if ((err = device_create_file(card->card_dev, &card_id_attrs)) < 0)
+			return err;
+		if ((err = device_create_file(card->card_dev, &card_number_attrs)) < 0)
+			return err;
 	}
 #endif
 	return 0;

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

* Re: [PATCH] sound: Fix warnings relating to ignored return value in snd_card_register
  2008-11-18 17:06   ` Hannes Eder
@ 2008-11-18 17:12     ` Richard Holden
  2008-11-18 17:12     ` Takashi Iwai
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Holden @ 2008-11-18 17:12 UTC (permalink / raw)
  To: Hannes Eder; +Cc: Takashi Iwai, Jaroslav Kysela, kernel-janitors, linux-kernel


On Nov 18, 2008, at 10:06 AM, Hannes Eder wrote:

> Do not ignore the return of 'device_create_file' in
> 'snd_card_register' and thereby fixing the following warnings:
>
> sound/core/init.c: In function 'snd_card_register':
> sound/core/init.c:640: warning: ignoring return value of
> 'device_create_file', declared with attribute warn_unused_result
> sound/core/init.c:641: warning: ignoring return value of
> 'device_create_file', declared with attribute warn_unused_result
>
> Signed-off-by: Hannes Eder <hannes@hanneseder.net>
> ---
>
> On Tue, Nov 18, 2008 at 11:14 AM, Takashi Iwai <tiwai@suse.de> wrote:
>> The changes look good, but please run checkpatch.pl to your patch and
>> fix the coding style issues suggested there.
>
> I did not fix:
>
> "WARNING: line over 80 characters" as they a hardly longer than 80
> characters and there are lines longer than this in the same file.
>
> "ERROR: do not use assignment in if condition" as this pattern seems
> to be quite common.
>
> Comments? Should I fix them?

I would definitely fix the ERROR, I have seen messages from Linus with  
really bad comments about using that construct. Most maintainers also  
won't want to take a patch where checkpatch reports an error. Also  
fixing the ERROR should also fix the warning.

-Richard Holden

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

* Re: [PATCH] sound: Fix warnings relating to ignored return value in snd_card_register
  2008-11-18 17:06   ` Hannes Eder
  2008-11-18 17:12     ` Richard Holden
@ 2008-11-18 17:12     ` Takashi Iwai
  2008-11-18 17:25       ` Hannes Eder
  1 sibling, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2008-11-18 17:12 UTC (permalink / raw)
  To: Hannes Eder; +Cc: Jaroslav Kysela, kernel-janitors, linux-kernel

At Tue, 18 Nov 2008 18:06:23 +0100,
Hannes Eder wrote:
> 
> Do not ignore the return of 'device_create_file' in
> 'snd_card_register' and thereby fixing the following warnings:
> 
> sound/core/init.c: In function 'snd_card_register':
> sound/core/init.c:640: warning: ignoring return value of
> 'device_create_file', declared with attribute warn_unused_result
> sound/core/init.c:641: warning: ignoring return value of
> 'device_create_file', declared with attribute warn_unused_result
> 
> Signed-off-by: Hannes Eder <hannes@hanneseder.net>
> ---
> 
> On Tue, Nov 18, 2008 at 11:14 AM, Takashi Iwai <tiwai@suse.de> wrote:
> > The changes look good, but please run checkpatch.pl to your patch and
> > fix the coding style issues suggested there.
> 
> I did not fix:
> 
> "WARNING: line over 80 characters" as they a hardly longer than 80
> characters and there are lines longer than this in the same file.

It's no excuse to add such lines again :)
(But, don't try to clean up the other lines -- mostly not worth, and
 it'd just make the change history dirty.)

> "ERROR: do not use assignment in if condition" as this pattern seems
> to be quite common.

Note this is an ERROR.

> Comments? Should I fix them?

Yes.


thanks,

Takashi

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

* Re: [PATCH] sound: Fix warnings relating to ignored return value in snd_card_register
  2008-11-18 17:12     ` Takashi Iwai
@ 2008-11-18 17:25       ` Hannes Eder
  2008-11-18 17:34         ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Hannes Eder @ 2008-11-18 17:25 UTC (permalink / raw)
  To: Takashi Iwai, Richard Holden
  Cc: Jaroslav Kysela, kernel-janitors, linux-kernel

Do not ignore the return of 'device_create_file' in
'snd_card_register' and thereby fixing the following warnings:

sound/core/init.c: In function 'snd_card_register':
sound/core/init.c:640: warning: ignoring return value of
'device_create_file', declared with attribute warn_unused_result
sound/core/init.c:641: warning: ignoring return value of
'device_create_file', declared with attribute warn_unused_result

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
All warnings and errors reported by checkpatch.pl fixed.

Thank you for your feedback.

 sound/core/init.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/sound/core/init.c b/sound/core/init.c
index af1e407..0d5520c 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -637,8 +637,12 @@ int snd_card_register(struct snd_card *card)
 #endif
 #ifndef CONFIG_SYSFS_DEPRECATED
 	if (card->card_dev) {
-		device_create_file(card->card_dev, &card_id_attrs);
-		device_create_file(card->card_dev, &card_number_attrs);
+		err = device_create_file(card->card_dev, &card_id_attrs);
+		if (err < 0)
+			return err;
+		err = device_create_file(card->card_dev, &card_number_attrs);
+		if (err < 0)
+			return err;
 	}
 #endif
 	return 0;

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

* Re: [PATCH] sound: Fix warnings relating to ignored return value in snd_card_register
  2008-11-18 17:25       ` Hannes Eder
@ 2008-11-18 17:34         ` Takashi Iwai
  0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2008-11-18 17:34 UTC (permalink / raw)
  To: Hannes Eder
  Cc: Richard Holden, Jaroslav Kysela, kernel-janitors, linux-kernel

At Tue, 18 Nov 2008 12:25:06 -0500,
Hannes Eder wrote:
> 
> Do not ignore the return of 'device_create_file' in
> 'snd_card_register' and thereby fixing the following warnings:
> 
> sound/core/init.c: In function 'snd_card_register':
> sound/core/init.c:640: warning: ignoring return value of
> 'device_create_file', declared with attribute warn_unused_result
> sound/core/init.c:641: warning: ignoring return value of
> 'device_create_file', declared with attribute warn_unused_result
> 
> Signed-off-by: Hannes Eder <hannes@hanneseder.net>
> ---
> All warnings and errors reported by checkpatch.pl fixed.

Thanks!  Applied now.


Takashi

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

end of thread, other threads:[~2008-11-18 17:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-18 15:59 [PATCH] sound: Fix warnings relating to ignored return value in snd_card_register Hannes Eder
2008-11-18 16:14 ` Takashi Iwai
2008-11-18 17:06   ` Hannes Eder
2008-11-18 17:12     ` Richard Holden
2008-11-18 17:12     ` Takashi Iwai
2008-11-18 17:25       ` Hannes Eder
2008-11-18 17:34         ` Takashi Iwai

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

all inboxes | Powered by JetHome®