public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Liam Girdwood" <lgirdwood@gmail.com>,
	"Mylène Josserand" <mylene.josserand@free-electrons.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>, "Chen-Yu Tsai" <wens@csie.org>,
	"Wei Yongjun" <yongjun_wei@trendmicro.com.cn>,
	alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] ASoC: sun4i-i2s: remove some dead code
Date: Tue, 07 Feb 2017 13:42:15 +0000	[thread overview]
Message-ID: <20170207134215.f47cufvs7tngrabk@lukather> (raw)
In-Reply-To: <20170207131934.GD28207@mwanda>

[-- Attachment #1: Type: text/plain, Size: 1282 bytes --]

Hi Dan,

On Tue, Feb 07, 2017 at 04:19:34PM +0300, Dan Carpenter wrote:
> "i2s->rst" is either NULL or a valid pointer.  We won't probe
> successfully if it's an error pointer.  That means these checks can be
> removed.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c
> index 3635bbc72cbc..d79be3e4361b 100644
> --- a/sound/soc/sunxi/sun4i-i2s.c
> +++ b/sound/soc/sunxi/sun4i-i2s.c
> @@ -723,13 +723,11 @@ static int sun4i_i2s_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> -	if (!IS_ERR(i2s->rst)) {
> -		ret = reset_control_deassert(i2s->rst);
> -		if (ret) {
> -			dev_err(&pdev->dev,
> -				"Failed to deassert the reset control\n");
> -			return -EINVAL;
> -		}
> +	ret = reset_control_deassert(i2s->rst);
> +	if (ret) {
> +		dev_err(&pdev->dev,
> +			"Failed to deassert the reset control\n");
> +		return -EINVAL;

In the case where has_reset is false, rst is NULL and will trigger a
WARN_ON in reset_control_deassert.

The proper fix would be to move it in the previous if block, or to
change the IS_ERR check for a NULL check.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  reply	other threads:[~2017-02-07 13:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 13:19 [patch] ASoC: sun4i-i2s: remove some dead code Dan Carpenter
2017-02-07 13:42 ` Maxime Ripard [this message]
2017-02-07 13:50   ` Dan Carpenter
2017-02-08  8:58     ` Maxime Ripard
2017-02-08  9:01       ` Chen-Yu Tsai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170207134215.f47cufvs7tngrabk@lukather \
    --to=maxime.ripard@free-electrons.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=mylene.josserand@free-electrons.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=wens@csie.org \
    --cc=yongjun_wei@trendmicro.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox