All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] ALSA: ak411x: simplify snd_ak4113_create() a bit
@ 2015-03-23  9:34 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2015-03-23  9:34 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: Takashi Iwai, alsa-devel, kernel-janitors

"err" is always a negative error code here, so there is no point in
checking.  Removing the check silences a static checker warning and
makes the code a bit more clear.  Also we don't need to initialize "err".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c
index 8884488..2183e9e 100644
--- a/sound/i2c/other/ak4113.c
+++ b/sound/i2c/other/ak4113.c
@@ -73,7 +73,7 @@ int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read,
 		void *private_data, struct ak4113 **r_ak4113)
 {
 	struct ak4113 *chip;
-	int err = 0;
+	int err;
 	unsigned char reg;
 	static struct snd_device_ops ops = {
 		.dev_free =     snd_ak4113_dev_free,
@@ -109,7 +109,7 @@ int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read,
 
 __fail:
 	snd_ak4113_free(chip);
-	return err < 0 ? err : -EIO;
+	return err;
 }
 EXPORT_SYMBOL_GPL(snd_ak4113_create);
 

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

* [patch] ALSA: ak411x: simplify snd_ak4113_create() a bit
@ 2015-03-23  9:34 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2015-03-23  9:34 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: Takashi Iwai, alsa-devel, kernel-janitors

"err" is always a negative error code here, so there is no point in
checking.  Removing the check silences a static checker warning and
makes the code a bit more clear.  Also we don't need to initialize "err".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c
index 8884488..2183e9e 100644
--- a/sound/i2c/other/ak4113.c
+++ b/sound/i2c/other/ak4113.c
@@ -73,7 +73,7 @@ int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read,
 		void *private_data, struct ak4113 **r_ak4113)
 {
 	struct ak4113 *chip;
-	int err = 0;
+	int err;
 	unsigned char reg;
 	static struct snd_device_ops ops = {
 		.dev_free =     snd_ak4113_dev_free,
@@ -109,7 +109,7 @@ int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read,
 
 __fail:
 	snd_ak4113_free(chip);
-	return err < 0 ? err : -EIO;
+	return err;
 }
 EXPORT_SYMBOL_GPL(snd_ak4113_create);
 

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

* Re: [patch] ALSA: ak411x: simplify snd_ak4113_create() a bit
  2015-03-23  9:34 ` Dan Carpenter
@ 2015-03-23 12:59   ` Takashi Iwai
  -1 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2015-03-23 12:59 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Jaroslav Kysela, alsa-devel, kernel-janitors

At Mon, 23 Mar 2015 12:34:46 +0300,
Dan Carpenter wrote:
> 
> "err" is always a negative error code here, so there is no point in
> checking.  Removing the check silences a static checker warning and
> makes the code a bit more clear.  Also we don't need to initialize "err".
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.


Takashi

> 
> diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c
> index 8884488..2183e9e 100644
> --- a/sound/i2c/other/ak4113.c
> +++ b/sound/i2c/other/ak4113.c
> @@ -73,7 +73,7 @@ int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read,
>  		void *private_data, struct ak4113 **r_ak4113)
>  {
>  	struct ak4113 *chip;
> -	int err = 0;
> +	int err;
>  	unsigned char reg;
>  	static struct snd_device_ops ops = {
>  		.dev_free =     snd_ak4113_dev_free,
> @@ -109,7 +109,7 @@ int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read,
>  
>  __fail:
>  	snd_ak4113_free(chip);
> -	return err < 0 ? err : -EIO;
> +	return err;
>  }
>  EXPORT_SYMBOL_GPL(snd_ak4113_create);
>  
> 

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

* Re: [patch] ALSA: ak411x: simplify snd_ak4113_create() a bit
@ 2015-03-23 12:59   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2015-03-23 12:59 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Jaroslav Kysela, alsa-devel, kernel-janitors

At Mon, 23 Mar 2015 12:34:46 +0300,
Dan Carpenter wrote:
> 
> "err" is always a negative error code here, so there is no point in
> checking.  Removing the check silences a static checker warning and
> makes the code a bit more clear.  Also we don't need to initialize "err".
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.


Takashi

> 
> diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c
> index 8884488..2183e9e 100644
> --- a/sound/i2c/other/ak4113.c
> +++ b/sound/i2c/other/ak4113.c
> @@ -73,7 +73,7 @@ int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read,
>  		void *private_data, struct ak4113 **r_ak4113)
>  {
>  	struct ak4113 *chip;
> -	int err = 0;
> +	int err;
>  	unsigned char reg;
>  	static struct snd_device_ops ops = {
>  		.dev_free =     snd_ak4113_dev_free,
> @@ -109,7 +109,7 @@ int snd_ak4113_create(struct snd_card *card, ak4113_read_t *read,
>  
>  __fail:
>  	snd_ak4113_free(chip);
> -	return err < 0 ? err : -EIO;
> +	return err;
>  }
>  EXPORT_SYMBOL_GPL(snd_ak4113_create);
>  
> 

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

end of thread, other threads:[~2015-03-23 12:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-23  9:34 [patch] ALSA: ak411x: simplify snd_ak4113_create() a bit Dan Carpenter
2015-03-23  9:34 ` Dan Carpenter
2015-03-23 12:59 ` Takashi Iwai
2015-03-23 12:59   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.