All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soc: imx: gpc: Use kemdup() function
@ 2018-03-11 23:19 Fabio Estevam
  2018-03-15  3:13 ` Shawn Guo
  0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2018-03-11 23:19 UTC (permalink / raw)
  To: linux-arm-kernel

From: Fabio Estevam <fabio.estevam@nxp.com>

Use kmemdup() rather than duplicating its implementation.

Detected with Coccinelle script.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
 drivers/soc/imx/gpc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c
index 196f17b..cc3bad8 100644
--- a/drivers/soc/imx/gpc.c
+++ b/drivers/soc/imx/gpc.c
@@ -444,12 +444,12 @@ static int imx_gpc_probe(struct platform_device *pdev)
 			if (domain_index >= of_id_data->num_domains)
 				continue;
 
-			domain = kmalloc(sizeof(*domain), GFP_KERNEL);
+			domain = kmemdup(&imx_gpc_domains[domain_index],
+					 sizeof(*domain), GFP_KERNEL);
 			if (!domain) {
 				of_node_put(np);
 				return -ENOMEM;
 			}
-			memcpy(domain, &imx_gpc_domains[domain_index], sizeof(*domain));
 			domain->regmap = regmap;
 			domain->ipg_rate_mhz = ipg_rate_mhz;
 
-- 
2.7.4

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

* [PATCH] soc: imx: gpc: Use kemdup() function
  2018-03-11 23:19 [PATCH] soc: imx: gpc: Use kemdup() function Fabio Estevam
@ 2018-03-15  3:13 ` Shawn Guo
  0 siblings, 0 replies; 2+ messages in thread
From: Shawn Guo @ 2018-03-15  3:13 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Fabio,

On Sun, Mar 11, 2018 at 08:19:42PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> Use kmemdup() rather than duplicating its implementation.
> 
> Detected with Coccinelle script.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>

I copied you on my reply to Andrey Smirnov, in which I requested to
use platform_device_add_data() for his patches.  That said, your patches
will be dropped as well.

Shawn

> ---
>  drivers/soc/imx/gpc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c
> index 196f17b..cc3bad8 100644
> --- a/drivers/soc/imx/gpc.c
> +++ b/drivers/soc/imx/gpc.c
> @@ -444,12 +444,12 @@ static int imx_gpc_probe(struct platform_device *pdev)
>  			if (domain_index >= of_id_data->num_domains)
>  				continue;
>  
> -			domain = kmalloc(sizeof(*domain), GFP_KERNEL);
> +			domain = kmemdup(&imx_gpc_domains[domain_index],
> +					 sizeof(*domain), GFP_KERNEL);
>  			if (!domain) {
>  				of_node_put(np);
>  				return -ENOMEM;
>  			}
> -			memcpy(domain, &imx_gpc_domains[domain_index], sizeof(*domain));
>  			domain->regmap = regmap;
>  			domain->ipg_rate_mhz = ipg_rate_mhz;
>  
> -- 
> 2.7.4
> 

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

end of thread, other threads:[~2018-03-15  3:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-11 23:19 [PATCH] soc: imx: gpc: Use kemdup() function Fabio Estevam
2018-03-15  3:13 ` Shawn Guo

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.