All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corentin Labbe <clabbe.montjoie@gmail.com>
To: Fabien Dessenne <fabien.dessenne@st.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Russell King <linux@armlinux.org.uk>,
	linux-crypto@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/4] crypto: stm32 - Support for STM32 CRC32 crypto module
Date: Tue, 14 Mar 2017 20:39:54 +0100	[thread overview]
Message-ID: <20170314193954.GA12137@Red> (raw)
In-Reply-To: <1489509446-32283-3-git-send-email-fabien.dessenne@st.com>

On Tue, Mar 14, 2017 at 05:37:24PM +0100, Fabien Dessenne wrote:
> +static int stm32_crc_remove(struct platform_device *pdev)
> +{
> +	struct stm32_crc *crc = platform_get_drvdata(pdev);
> +
> +	spin_lock(&crc_list.lock);
> +	list_del(&crc->list);
> +	spin_unlock(&crc_list.lock);
> +
> +	crypto_unregister_shash(algs);
> +
> +	if (crc && crc->clk)
> +		clk_disable_unprepare(crc->clk);

Hello

No need to test for crc, if it was NULL, you dereference it just before in list_del.
Furthermore, It seems that clk_disable_unprepare() handle perfectly NULL, so no test is needed.

Regards
Corentin Labbe

WARNING: multiple messages have this Message-ID (diff)
From: clabbe.montjoie@gmail.com (Corentin Labbe)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] crypto: stm32 - Support for STM32 CRC32 crypto module
Date: Tue, 14 Mar 2017 20:39:54 +0100	[thread overview]
Message-ID: <20170314193954.GA12137@Red> (raw)
In-Reply-To: <1489509446-32283-3-git-send-email-fabien.dessenne@st.com>

On Tue, Mar 14, 2017 at 05:37:24PM +0100, Fabien Dessenne wrote:
> +static int stm32_crc_remove(struct platform_device *pdev)
> +{
> +	struct stm32_crc *crc = platform_get_drvdata(pdev);
> +
> +	spin_lock(&crc_list.lock);
> +	list_del(&crc->list);
> +	spin_unlock(&crc_list.lock);
> +
> +	crypto_unregister_shash(algs);
> +
> +	if (crc && crc->clk)
> +		clk_disable_unprepare(crc->clk);

Hello

No need to test for crc, if it was NULL, you dereference it just before in list_del.
Furthermore, It seems that clk_disable_unprepare() handle perfectly NULL, so no test is needed.

Regards
Corentin Labbe

  reply	other threads:[~2017-03-14 19:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-14 16:37 [PATCH 0/4] STM32 CRC crypto driver Fabien Dessenne
2017-03-14 16:37 ` Fabien Dessenne
2017-03-14 16:37 ` Fabien Dessenne
     [not found] ` <1489509446-32283-1-git-send-email-fabien.dessenne-qxv4g6HH51o@public.gmane.org>
2017-03-14 16:37   ` [PATCH 1/4] dt-bindings: Document STM32 CRC bindings Fabien Dessenne
2017-03-14 16:37     ` Fabien Dessenne
2017-03-14 16:37     ` Fabien Dessenne
2017-03-14 16:37   ` [PATCH 2/4] crypto: stm32 - Support for STM32 CRC32 crypto module Fabien Dessenne
2017-03-14 16:37     ` Fabien Dessenne
2017-03-14 16:37     ` Fabien Dessenne
2017-03-14 19:39     ` Corentin Labbe [this message]
2017-03-14 19:39       ` Corentin Labbe
2017-03-14 16:37   ` [PATCH 3/4] ARM: dts: stm32: Add CRC support to stm32f746 Fabien Dessenne
2017-03-14 16:37     ` Fabien Dessenne
2017-03-14 16:37     ` Fabien Dessenne
2017-03-14 16:37   ` [PATCH 4/4] ARM: dts: stm32: enable CRC on stm32746g-eval board Fabien Dessenne
2017-03-14 16:37     ` Fabien Dessenne
2017-03-14 16:37     ` Fabien Dessenne

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=20170314193954.GA12137@Red \
    --to=clabbe.montjoie@gmail.com \
    --cc=alexandre.torgue@st.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=fabien.dessenne@st.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=robh+dt@kernel.org \
    /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 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.