M25p80 little bugs
PATCH v2 1/1 M25p80 little bugs
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 <[email protected]>
--- drivers/mtd/devices/m25p80.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/mtd/devices/m25p80.c +6 -7
@@ -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 {
Signature · 1 line
1.7.9.5
Dear wangyuhang,
Quoted 6 lines
Hi, Marek
Really sorry for the previous deformed patch. And you are right, using
devm_kzalloclooks better. I have resended the patch, please help me review. Thanks.
Now just fix the commit message and you're done, thanks! ;-)
Quoted 28 lines
Signed-off-by wangyuhang <[email protected]>--- drivers/mtd/devices/m25p80.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)drivers/mtd/devices/m25p80.c +1
-7@@ -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;
drivers/mtd/devices/m25p80.c static int m25p_probe(struct spi_device *spi) · line 1036
Quoted 10 lines
drivers/mtd/devices/m25p80.c +5
-0#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