* [PATCH] soc: imx: gpcv2: Use kemdup() function
@ 2018-03-11 23:29 Fabio Estevam
0 siblings, 0 replies; only message in thread
From: Fabio Estevam @ 2018-03-11 23:29 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/gpcv2.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c
index 9947598..6d3c0f2 100644
--- a/drivers/soc/imx/gpcv2.c
+++ b/drivers/soc/imx/gpcv2.c
@@ -322,13 +322,12 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
continue;
}
- domain = kmalloc(sizeof(*domain), GFP_KERNEL);
+ domain = kmemdup(&imx7_pgc_domains[domain_index],
+ sizeof(*domain), GFP_KERNEL);
if (!domain) {
of_node_put(np);
return -ENOMEM;
}
- memcpy(domain, &imx7_pgc_domains[domain_index],
- sizeof(*domain));
domain->regmap = regmap;
domain->genpd.power_on = imx7_gpc_pu_pgc_sw_pup_req;
--
2.7.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-03-11 23:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-11 23:29 [PATCH] soc: imx: gpcv2: Use kemdup() function Fabio Estevam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).