From: Ryan Mallon <ryan@bluewatersys.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Walleij <linus.ml.walleij@gmail.com>,
linux kernel <linux-kernel@vger.kernel.org>,
spi-devel-general@lists.sourceforge.net,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH] SST25L (non JEDEC) SPI Flash driver
Date: Thu, 25 Jun 2009 15:07:17 +1200 [thread overview]
Message-ID: <4A42E9E5.60802@bluewatersys.com> (raw)
In-Reply-To: <20090624194005.2f9574ce.akpm@linux-foundation.org>
Andrew Morton wrote:
> On Thu, 25 Jun 2009 11:59:47 +1200 Ryan Mallon <ryan@bluewatersys.com> wrote:
>
>
>> Add support for the non JEDEC SST25L SPI Flash devices.
>>
>> Signed-off-by: Andre Renaud <andre@bluewatersys.com>
>> Signed-off-by: Ryan Mallon <ryan@bluewatersys.com>
>> Acked-by: Linus Walleij <linus.walleij@stericsson.com>
>>
>
> It looks OK to my inexperienced eye.
>
>
Cool, thanks for picking this up. The patch below fixes the two issues
you pointed out. It will apply on top of
mtd-sst25l-non-jedec-spi-flash-driver-update.patch
----
Fix two issues in the SSTL25 driver:
- Replace min() plus u32 cast with min_t
- Fix memory leak on failed add_mtd_device
Signed-off-by: Ryan Mallon <ryan@bluewatersys.com>
----
diff --git a/drivers/mtd/devices/sst25l.c b/drivers/mtd/devices/sst25l.c
index 777fadf..d235067 100644
--- a/drivers/mtd/devices/sst25l.c
+++ b/drivers/mtd/devices/sst25l.c
@@ -298,7 +298,7 @@ static int sst25l_write(struct mtd_info *mtd, loff_t to, size_t len,
* Write the remaining bytes using auto address
* increment mode
*/
- bytes = min(mtd->writesize, (u32)(len - i));
+ bytes = min_t(u32, mtd->writesize, len - i);
for (j = 1; j < bytes; j++, copied++) {
ret = sst25l_wait_till_ready(flash);
if (ret)
@@ -367,7 +367,7 @@ static int __init sst25l_probe(struct spi_device *spi)
struct flash_info *flash_info;
struct sst25l_flash *flash;
struct flash_platform_data *data;
- int i;
+ int ret, i;
flash_info = sst25l_match_device(spi);
if (!flash_info)
@@ -457,7 +457,14 @@ static int __init sst25l_probe(struct spi_device *spi)
data->nr_parts, data->name);
}
- return add_mtd_device(&flash->mtd) == 1 ? -ENODEV : 0;
+ ret = add_mtd_device(&flash->mtd);
+ if (ret == 1) {
+ kfree(flash);
+ dev_set_drvdata(&spi->dev, NULL);
+ return -ENODEV;
+ }
+
+ return 0;
}
static int __exit sst25l_remove(struct spi_device *spi)
next prev parent reply other threads:[~2009-06-25 3:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-24 23:59 [PATCH] SST25L (non JEDEC) SPI Flash driver Ryan Mallon
2009-06-25 0:08 ` Linus Walleij
2009-07-03 0:50 ` [spi-devel-general] " David Brownell
2009-06-25 2:40 ` Andrew Morton
2009-06-25 3:07 ` Ryan Mallon [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-06-22 3:58 Ryan Mallon
2009-06-22 8:15 ` Artem Bityutskiy
2009-06-22 8:22 ` Linus Walleij
2009-06-22 21:56 ` Ryan Mallon
2009-06-23 7:04 ` Linus Walleij
2009-06-23 20:48 ` Ryan Mallon
2009-06-24 22:43 ` Linus Walleij
2009-06-24 22:49 ` Ryan Mallon
2009-06-24 23:49 ` Linus Walleij
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=4A42E9E5.60802@bluewatersys.com \
--to=ryan@bluewatersys.com \
--cc=akpm@linux-foundation.org \
--cc=dwmw2@infradead.org \
--cc=linus.ml.walleij@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=spi-devel-general@lists.sourceforge.net \
/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