public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bryan Wu <cooloney@kernel.org>
To: dbrownell@users.sourceforge.net, spi-devel-general@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org,
	Mike Frysinger <vapier.adi@gmail.com>,
	Bryan Wu <cooloney@kernel.org>
Subject: [PATCH 3/5] Blackfin SPI Driver: fix NULL pointer crash
Date: Thu,  5 Feb 2009 18:07:31 +0800	[thread overview]
Message-ID: <1233828453-13311-4-git-send-email-cooloney@kernel.org> (raw)
In-Reply-To: <1233828453-13311-1-git-send-email-cooloney@kernel.org>

From: Mike Frysinger <vapier.adi@gmail.com>

fix NULL pointer crash when cleaning up from invalid platform resources

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
 drivers/spi/spi_bfin5xx.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index ce24d5e..b6098b5 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -1240,6 +1240,9 @@ static void bfin_spi_cleanup(struct spi_device *spi)
 {
 	struct chip_data *chip = spi_get_ctldata(spi);
 
+	if (!chip)
+		return;
+
 	if ((chip->chip_select_num > 0)
 		&& (chip->chip_select_num <= spi->master->num_chipselect))
 		peripheral_free(ssel[spi->master->bus_num]
-- 
1.5.6.3

  parent reply	other threads:[~2009-02-05 10:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-05 10:07 [PATCH 0/5] Blackfin SPI Driver updates Bryan Wu
2009-02-05 10:07 ` [PATCH 1/5] Blackfin SPI Driver: use bfin_spi_ prefix on all functions Bryan Wu
2009-02-05 22:12   ` Andrew Morton
2009-02-06  2:26     ` Bryan Wu
2009-02-06  2:34     ` Stephen Rothwell
2009-02-06  2:47       ` Andrew Morton
2009-02-05 10:07 ` [PATCH 2/5] Blackfin SPI Driver: add comment about full duplex dma according to David Brownell Bryan Wu
2009-02-05 10:07 ` Bryan Wu [this message]
2009-02-05 22:12   ` [PATCH 3/5] Blackfin SPI Driver: fix NULL pointer crash Andrew Morton
2009-02-05 22:29     ` Mike Frysinger
2009-02-05 10:07 ` [PATCH 4/5] Blackfin SPI Driver: Add GPIO controlled SPI Slave Select support Bryan Wu
2009-02-05 22:12   ` Andrew Morton
2009-02-05 10:07 ` [PATCH 5/5] Blackfin SPI Driver: Make mmc_spi driver work on Blackfin Bryan Wu
2009-02-05 22:13   ` Andrew Morton

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=1233828453-13311-4-git-send-email-cooloney@kernel.org \
    --to=cooloney@kernel.org \
    --cc=dbrownell@users.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    --cc=vapier.adi@gmail.com \
    /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