All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: oxnas_nand: Allocating more than necessary in probe()
@ 2017-04-25  9:19 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2017-04-25  9:19 UTC (permalink / raw)
  To: Boris Brezillon, Neil Armstrong
  Cc: Richard Weinberger, David Woodhouse, Brian Norris, Marek Vasut,
	Cyrille Pitchen, linux-mtd, linux-oxnas, kernel-janitors

We only need to allocate sizeof(struct oxnas_nand_ctrl) which is 192
bytes and not sizeof(struct nand_chip) which is a much larger 3056
bytes.

Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/mtd/nand/oxnas_nand.c b/drivers/mtd/nand/oxnas_nand.c
index 3e3bf3b364d2..1b207aac840c 100644
--- a/drivers/mtd/nand/oxnas_nand.c
+++ b/drivers/mtd/nand/oxnas_nand.c
@@ -91,7 +91,7 @@ static int oxnas_nand_probe(struct platform_device *pdev)
 	int err = 0;
 
 	/* Allocate memory for the device structure (and zero it) */
-	oxnas = devm_kzalloc(&pdev->dev, sizeof(struct nand_chip),
+	oxnas = devm_kzalloc(&pdev->dev, sizeof(*oxnas),
 			     GFP_KERNEL);
 	if (!oxnas)
 		return -ENOMEM;

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] mtd: oxnas_nand: Allocating more than necessary in probe()
@ 2017-04-25  9:19 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2017-04-25  9:19 UTC (permalink / raw)
  To: Boris Brezillon, Neil Armstrong
  Cc: Richard Weinberger, David Woodhouse, Brian Norris, Marek Vasut,
	Cyrille Pitchen, linux-mtd, linux-oxnas, kernel-janitors

We only need to allocate sizeof(struct oxnas_nand_ctrl) which is 192
bytes and not sizeof(struct nand_chip) which is a much larger 3056
bytes.

Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/mtd/nand/oxnas_nand.c b/drivers/mtd/nand/oxnas_nand.c
index 3e3bf3b364d2..1b207aac840c 100644
--- a/drivers/mtd/nand/oxnas_nand.c
+++ b/drivers/mtd/nand/oxnas_nand.c
@@ -91,7 +91,7 @@ static int oxnas_nand_probe(struct platform_device *pdev)
 	int err = 0;
 
 	/* Allocate memory for the device structure (and zero it) */
-	oxnas = devm_kzalloc(&pdev->dev, sizeof(struct nand_chip),
+	oxnas = devm_kzalloc(&pdev->dev, sizeof(*oxnas),
 			     GFP_KERNEL);
 	if (!oxnas)
 		return -ENOMEM;

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] mtd: oxnas_nand: Allocating more than necessary in probe()
  2017-04-25  9:19 ` Dan Carpenter
@ 2017-04-25  9:42   ` Neil Armstrong
  -1 siblings, 0 replies; 8+ messages in thread
From: Neil Armstrong @ 2017-04-25  9:42 UTC (permalink / raw)
  To: Dan Carpenter, Boris Brezillon
  Cc: Richard Weinberger, David Woodhouse, Brian Norris, Marek Vasut,
	Cyrille Pitchen, linux-mtd, linux-oxnas, kernel-janitors

On 04/25/2017 11:19 AM, Dan Carpenter wrote:
> We only need to allocate sizeof(struct oxnas_nand_ctrl) which is 192
> bytes and not sizeof(struct nand_chip) which is a much larger 3056
> bytes.
> 
> Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/mtd/nand/oxnas_nand.c b/drivers/mtd/nand/oxnas_nand.c
> index 3e3bf3b364d2..1b207aac840c 100644
> --- a/drivers/mtd/nand/oxnas_nand.c
> +++ b/drivers/mtd/nand/oxnas_nand.c
> @@ -91,7 +91,7 @@ static int oxnas_nand_probe(struct platform_device *pdev)
>  	int err = 0;
>  
>  	/* Allocate memory for the device structure (and zero it) */
> -	oxnas = devm_kzalloc(&pdev->dev, sizeof(struct nand_chip),
> +	oxnas = devm_kzalloc(&pdev->dev, sizeof(*oxnas),
>  			     GFP_KERNEL);
>  	if (!oxnas)
>  		return -ENOMEM;
> 

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mtd: oxnas_nand: Allocating more than necessary in probe()
@ 2017-04-25  9:42   ` Neil Armstrong
  0 siblings, 0 replies; 8+ messages in thread
From: Neil Armstrong @ 2017-04-25  9:42 UTC (permalink / raw)
  To: Dan Carpenter, Boris Brezillon
  Cc: Richard Weinberger, David Woodhouse, Brian Norris, Marek Vasut,
	Cyrille Pitchen, linux-mtd, linux-oxnas, kernel-janitors

On 04/25/2017 11:19 AM, Dan Carpenter wrote:
> We only need to allocate sizeof(struct oxnas_nand_ctrl) which is 192
> bytes and not sizeof(struct nand_chip) which is a much larger 3056
> bytes.
> 
> Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/mtd/nand/oxnas_nand.c b/drivers/mtd/nand/oxnas_nand.c
> index 3e3bf3b364d2..1b207aac840c 100644
> --- a/drivers/mtd/nand/oxnas_nand.c
> +++ b/drivers/mtd/nand/oxnas_nand.c
> @@ -91,7 +91,7 @@ static int oxnas_nand_probe(struct platform_device *pdev)
>  	int err = 0;
>  
>  	/* Allocate memory for the device structure (and zero it) */
> -	oxnas = devm_kzalloc(&pdev->dev, sizeof(struct nand_chip),
> +	oxnas = devm_kzalloc(&pdev->dev, sizeof(*oxnas),
>  			     GFP_KERNEL);
>  	if (!oxnas)
>  		return -ENOMEM;
> 

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mtd: oxnas_nand: Allocating more than necessary in probe()
  2017-04-25  9:19 ` Dan Carpenter
@ 2017-05-02 16:19   ` Boris Brezillon
  -1 siblings, 0 replies; 8+ messages in thread
From: Boris Brezillon @ 2017-05-02 16:19 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Neil Armstrong, Richard Weinberger, David Woodhouse,
	Brian Norris, Marek Vasut, Cyrille Pitchen, linux-mtd,
	linux-oxnas, kernel-janitors

On Tue, 25 Apr 2017 12:19:49 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> We only need to allocate sizeof(struct oxnas_nand_ctrl) which is 192
> bytes and not sizeof(struct nand_chip) which is a much larger 3056
> bytes.
> 
> Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> 
> diff --git a/drivers/mtd/nand/oxnas_nand.c b/drivers/mtd/nand/oxnas_nand.c
> index 3e3bf3b364d2..1b207aac840c 100644
> --- a/drivers/mtd/nand/oxnas_nand.c
> +++ b/drivers/mtd/nand/oxnas_nand.c
> @@ -91,7 +91,7 @@ static int oxnas_nand_probe(struct platform_device *pdev)
>  	int err = 0;
>  
>  	/* Allocate memory for the device structure (and zero it) */
> -	oxnas = devm_kzalloc(&pdev->dev, sizeof(struct nand_chip),
> +	oxnas = devm_kzalloc(&pdev->dev, sizeof(*oxnas),
>  			     GFP_KERNEL);
>  	if (!oxnas)
>  		return -ENOMEM;


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mtd: oxnas_nand: Allocating more than necessary in probe()
@ 2017-05-02 16:19   ` Boris Brezillon
  0 siblings, 0 replies; 8+ messages in thread
From: Boris Brezillon @ 2017-05-02 16:19 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Neil Armstrong, Richard Weinberger, David Woodhouse,
	Brian Norris, Marek Vasut, Cyrille Pitchen, linux-mtd,
	linux-oxnas, kernel-janitors

On Tue, 25 Apr 2017 12:19:49 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> We only need to allocate sizeof(struct oxnas_nand_ctrl) which is 192
> bytes and not sizeof(struct nand_chip) which is a much larger 3056
> bytes.
> 
> Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> 
> diff --git a/drivers/mtd/nand/oxnas_nand.c b/drivers/mtd/nand/oxnas_nand.c
> index 3e3bf3b364d2..1b207aac840c 100644
> --- a/drivers/mtd/nand/oxnas_nand.c
> +++ b/drivers/mtd/nand/oxnas_nand.c
> @@ -91,7 +91,7 @@ static int oxnas_nand_probe(struct platform_device *pdev)
>  	int err = 0;
>  
>  	/* Allocate memory for the device structure (and zero it) */
> -	oxnas = devm_kzalloc(&pdev->dev, sizeof(struct nand_chip),
> +	oxnas = devm_kzalloc(&pdev->dev, sizeof(*oxnas),
>  			     GFP_KERNEL);
>  	if (!oxnas)
>  		return -ENOMEM;

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mtd: oxnas_nand: Allocating more than necessary in probe()
  2017-04-25  9:19 ` Dan Carpenter
@ 2017-05-03  1:58   ` Brian Norris
  -1 siblings, 0 replies; 8+ messages in thread
From: Brian Norris @ 2017-05-03  1:58 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Boris Brezillon, Neil Armstrong, Richard Weinberger,
	David Woodhouse, Marek Vasut, Cyrille Pitchen, linux-mtd,
	linux-oxnas, kernel-janitors

On Tue, Apr 25, 2017 at 12:19:49PM +0300, Dan Carpenter wrote:
> We only need to allocate sizeof(struct oxnas_nand_ctrl) which is 192
> bytes and not sizeof(struct nand_chip) which is a much larger 3056
> bytes.
> 
> Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied to l2-mtd.git

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mtd: oxnas_nand: Allocating more than necessary in probe()
@ 2017-05-03  1:58   ` Brian Norris
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Norris @ 2017-05-03  1:58 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Boris Brezillon, Neil Armstrong, Richard Weinberger,
	David Woodhouse, Marek Vasut, Cyrille Pitchen, linux-mtd,
	linux-oxnas, kernel-janitors

On Tue, Apr 25, 2017 at 12:19:49PM +0300, Dan Carpenter wrote:
> We only need to allocate sizeof(struct oxnas_nand_ctrl) which is 192
> bytes and not sizeof(struct nand_chip) which is a much larger 3056
> bytes.
> 
> Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied to l2-mtd.git

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-05-03  1:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25  9:19 [PATCH] mtd: oxnas_nand: Allocating more than necessary in probe() Dan Carpenter
2017-04-25  9:19 ` Dan Carpenter
2017-04-25  9:42 ` Neil Armstrong
2017-04-25  9:42   ` Neil Armstrong
2017-05-02 16:19 ` Boris Brezillon
2017-05-02 16:19   ` Boris Brezillon
2017-05-03  1:58 ` Brian Norris
2017-05-03  1:58   ` Brian Norris

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.