Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: jonas.jensen@gmail.com, linux-mmc@vger.kernel.org
Subject: Re: mmc: moxart: Add MOXA ART SD/MMC driver
Date: Wed, 21 May 2014 14:33:57 +0200	[thread overview]
Message-ID: <4199288.qtcULgjJrP@wuerfel> (raw)
In-Reply-To: <20140521122825.GE23396@mwanda>

On Wednesday 21 May 2014 15:28:25 Dan Carpenter wrote:
> Hello Jonas Jensen,
> 
> The patch 1b66e94e6b99: "mmc: moxart: Add MOXA ART SD/MMC driver"
> from Apr 9, 2014, leads to the following static checker warning:
> 
>         drivers/mmc/host/moxart-mmc.c:691 moxart_remove()
>         warn: variable dereferenced before check 'mmc' (see line 687)
> 
> drivers/mmc/host/moxart-mmc.c
>    684  static int moxart_remove(struct platform_device *pdev)
>    685  {
>    686          struct mmc_host *mmc = dev_get_drvdata(&pdev->dev);
>    687          struct moxart_host *host = mmc_priv(mmc);
>                                            ^^^^^^^^^^^^^
> Dereference.
> 
>    688  
>    689          dev_set_drvdata(&pdev->dev, NULL);
>    690  
>    691          if (mmc) {
>                     ^^^
> Check.

Right, the check should just be removed, because the moxart_remove
function will not be called unless moxart_probe() has successfully
set the drvdata.


On a related note, I also found two bugs using automated build testing:

a) The driver should use dma_request_slave_channel_reason() instead of
of_dma_request_slave_channel() so it can be compiled when CONFIG_OF is
disabled.

b) moxart_remove() contains an extraneous kfree(host), where host is
a variable that has already been freed at that point.

	Arnd

  reply	other threads:[~2014-05-21 12:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-21 12:28 mmc: moxart: Add MOXA ART SD/MMC driver Dan Carpenter
2014-05-21 12:33 ` Arnd Bergmann [this message]
2014-05-21 12:52 ` Jonas Jensen

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=4199288.qtcULgjJrP@wuerfel \
    --to=arnd@arndb.de \
    --cc=dan.carpenter@oracle.com \
    --cc=jonas.jensen@gmail.com \
    --cc=linux-mmc@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox