* [PATCH v2] M25p80 little bugs
@ 2013-07-12 6:33 wangyuhang
2013-07-12 11:49 ` Marek Vasut
0 siblings, 1 reply; 2+ messages in thread
From: wangyuhang @ 2013-07-12 6:33 UTC (permalink / raw)
To: marex; +Cc: artem.bityutskiy, wfp5p, swarren, wangyuhang, linux-mtd
Hi, Marek
Really sorry for the previous deformed patch.
And you are right, using devm_kzalloc looks better.
I have resended the patch, please help me review.
Thanks.
Signed-off-by: wangyuhang <wangyuhang2014@gmail.com>
---
drivers/mtd/devices/m25p80.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 5b6b072..70f3c54 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -955,15 +955,9 @@ static int m25p_probe(struct spi_device *spi)
}
}
- flash = kzalloc(sizeof *flash, GFP_KERNEL);
+ flash = devm_kzalloc(&spi->dev, sizeof *flash, GFP_KERNEL);
if (!flash)
return -ENOMEM;
- flash->command = kmalloc(MAX_CMD_SIZE + (flash->fast_read ? 1 : 0),
- GFP_KERNEL);
- if (!flash->command) {
- kfree(flash);
- return -ENOMEM;
- }
flash->spi = spi;
mutex_init(&flash->lock);
@@ -1032,6 +1026,11 @@ static int m25p_probe(struct spi_device *spi)
flash->fast_read = true;
#endif
+ flash->command = devm_kzalloc(&spi->dev,
+ MAX_CMD_SIZE + (flash->fast_read ? 1 : 0), GFP_KERNEL);
+ if (!flash->command)
+ return -ENOMEM;
+
if (info->addr_width)
flash->addr_width = info->addr_width;
else {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] M25p80 little bugs
2013-07-12 6:33 [PATCH v2] M25p80 little bugs wangyuhang
@ 2013-07-12 11:49 ` Marek Vasut
0 siblings, 0 replies; 2+ messages in thread
From: Marek Vasut @ 2013-07-12 11:49 UTC (permalink / raw)
To: wangyuhang; +Cc: artem.bityutskiy, wfp5p, swarren, linux-mtd
Dear wangyuhang,
> Hi, Marek
>
> Really sorry for the previous deformed patch.
> And you are right, using devm_kzalloc looks better.
> I have resended the patch, please help me review.
> Thanks.
Now just fix the commit message and you're done, thanks! ;-)
> Signed-off-by: wangyuhang <wangyuhang2014@gmail.com>
> ---
> drivers/mtd/devices/m25p80.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
> index 5b6b072..70f3c54 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
> @@ -955,15 +955,9 @@ static int m25p_probe(struct spi_device *spi)
> }
> }
>
> - flash = kzalloc(sizeof *flash, GFP_KERNEL);
> + flash = devm_kzalloc(&spi->dev, sizeof *flash, GFP_KERNEL);
> if (!flash)
> return -ENOMEM;
> - flash->command = kmalloc(MAX_CMD_SIZE + (flash->fast_read ? 1 : 0),
> - GFP_KERNEL);
> - if (!flash->command) {
> - kfree(flash);
> - return -ENOMEM;
> - }
>
> flash->spi = spi;
> mutex_init(&flash->lock);
> @@ -1032,6 +1026,11 @@ static int m25p_probe(struct spi_device *spi)
> flash->fast_read = true;
> #endif
>
> + flash->command = devm_kzalloc(&spi->dev,
> + MAX_CMD_SIZE + (flash->fast_read ? 1 : 0), GFP_KERNEL);
> + if (!flash->command)
> + return -ENOMEM;
> +
> if (info->addr_width)
> flash->addr_width = info->addr_width;
> else {
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-12 11:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-12 6:33 [PATCH v2] M25p80 little bugs wangyuhang
2013-07-12 11:49 ` Marek Vasut
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.