From: Nicholas Mc Guire <hofrat@osadl.org>
To: Li Yang <leoyang.li@nxp.com>
Cc: linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Nicholas Mc Guire <hofrat@osadl.org>
Subject: [PATCH] soc: fsl: guts: us devm_kstrdup_const() for RO data
Date: Fri, 7 Dec 2018 09:22:43 +0100 [thread overview]
Message-ID: <1544170963-8386-1-git-send-email-hofrat@osadl.org> (raw)
devm_kstrdup() may return NULL if internal allocation failed, but
as machine is from the device tree, and thus RO, devm_kstrdup_const()
can be used here, which will only copy the reference.
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: a6fc3b698130 ("soc: fsl: add GUTS driver for QorIQ platforms")
---
Problem located by experimental coccinelle script
Patch was compile tested with: multi_v7_defconfig (implies FSL_GUTS=y)
Patch is against 4.20-rc5 (localversion-next is next-20181207)
drivers/soc/fsl/guts.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
index 302e0c8..15071ec 100644
--- a/drivers/soc/fsl/guts.c
+++ b/drivers/soc/fsl/guts.c
@@ -157,7 +157,8 @@ static int fsl_guts_probe(struct platform_device *pdev)
of_property_read_string_index(root, "compatible", 0, &machine);
of_node_put(root);
if (machine)
- soc_dev_attr.machine = devm_kstrdup(dev, machine, GFP_KERNEL);
+ soc_dev_attr.machine = devm_kstrdup_const(dev, machine,
+ GFP_KERNEL);
svr = fsl_guts_get_svr();
soc_die = fsl_soc_die_match(svr, fsl_soc_die);
--
2.1.4
WARNING: multiple messages have this Message-ID (diff)
From: Nicholas Mc Guire <hofrat@osadl.org>
To: Li Yang <leoyang.li@nxp.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Nicholas Mc Guire <hofrat@osadl.org>
Subject: [PATCH] soc: fsl: guts: us devm_kstrdup_const() for RO data
Date: Fri, 7 Dec 2018 09:22:43 +0100 [thread overview]
Message-ID: <1544170963-8386-1-git-send-email-hofrat@osadl.org> (raw)
devm_kstrdup() may return NULL if internal allocation failed, but
as machine is from the device tree, and thus RO, devm_kstrdup_const()
can be used here, which will only copy the reference.
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: a6fc3b698130 ("soc: fsl: add GUTS driver for QorIQ platforms")
---
Problem located by experimental coccinelle script
Patch was compile tested with: multi_v7_defconfig (implies FSL_GUTS=y)
Patch is against 4.20-rc5 (localversion-next is next-20181207)
drivers/soc/fsl/guts.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
index 302e0c8..15071ec 100644
--- a/drivers/soc/fsl/guts.c
+++ b/drivers/soc/fsl/guts.c
@@ -157,7 +157,8 @@ static int fsl_guts_probe(struct platform_device *pdev)
of_property_read_string_index(root, "compatible", 0, &machine);
of_node_put(root);
if (machine)
- soc_dev_attr.machine = devm_kstrdup(dev, machine, GFP_KERNEL);
+ soc_dev_attr.machine = devm_kstrdup_const(dev, machine,
+ GFP_KERNEL);
svr = fsl_guts_get_svr();
soc_die = fsl_soc_die_match(svr, fsl_soc_die);
--
2.1.4
WARNING: multiple messages have this Message-ID (diff)
From: Nicholas Mc Guire <hofrat@osadl.org>
To: Li Yang <leoyang.li@nxp.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Nicholas Mc Guire <hofrat@osadl.org>
Subject: [PATCH] soc: fsl: guts: us devm_kstrdup_const() for RO data
Date: Fri, 7 Dec 2018 09:22:43 +0100 [thread overview]
Message-ID: <1544170963-8386-1-git-send-email-hofrat@osadl.org> (raw)
devm_kstrdup() may return NULL if internal allocation failed, but
as machine is from the device tree, and thus RO, devm_kstrdup_const()
can be used here, which will only copy the reference.
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: a6fc3b698130 ("soc: fsl: add GUTS driver for QorIQ platforms")
---
Problem located by experimental coccinelle script
Patch was compile tested with: multi_v7_defconfig (implies FSL_GUTS=y)
Patch is against 4.20-rc5 (localversion-next is next-20181207)
drivers/soc/fsl/guts.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
index 302e0c8..15071ec 100644
--- a/drivers/soc/fsl/guts.c
+++ b/drivers/soc/fsl/guts.c
@@ -157,7 +157,8 @@ static int fsl_guts_probe(struct platform_device *pdev)
of_property_read_string_index(root, "compatible", 0, &machine);
of_node_put(root);
if (machine)
- soc_dev_attr.machine = devm_kstrdup(dev, machine, GFP_KERNEL);
+ soc_dev_attr.machine = devm_kstrdup_const(dev, machine,
+ GFP_KERNEL);
svr = fsl_guts_get_svr();
soc_die = fsl_soc_die_match(svr, fsl_soc_die);
--
2.1.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2018-12-07 8:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-07 8:22 Nicholas Mc Guire [this message]
2018-12-07 8:22 ` [PATCH] soc: fsl: guts: us devm_kstrdup_const() for RO data Nicholas Mc Guire
2018-12-07 8:22 ` Nicholas Mc Guire
2018-12-22 2:29 ` Scott Wood
2018-12-22 2:29 ` Scott Wood
2018-12-22 7:59 ` Nicholas Mc Guire
2018-12-22 7:59 ` Nicholas Mc Guire
2018-12-22 7:59 ` Nicholas Mc Guire
2019-01-10 19:43 ` Li Yang
2019-01-10 19:43 ` Li Yang
2019-01-10 19:43 ` Li Yang
2019-01-11 2:43 ` Nicholas Mc Guire
2019-01-11 2:43 ` Nicholas Mc Guire
2019-01-11 2:43 ` Nicholas Mc Guire
2019-01-11 21:32 ` Leo Li
2019-01-11 21:32 ` Leo Li
2019-01-11 21:32 ` Leo Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1544170963-8386-1-git-send-email-hofrat@osadl.org \
--to=hofrat@osadl.org \
--cc=leoyang.li@nxp.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.