* [PATCH] powerpc/windfarm: don't pass const strings to snprintf
@ 2012-05-03 6:19 Stephen Rothwell
2012-05-03 10:35 ` David Laight
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Rothwell @ 2012-05-03 6:19 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: ppc-dev
[-- Attachment #1: Type: text/plain, Size: 1838 bytes --]
Fixes these build warnings:
drivers/macintosh/windfarm_smu_sat.c: In function 'wf_sat_probe':
drivers/macintosh/windfarm_smu_sat.c:290:3: warning: passing argument 1 of 'snprintf' discards qualifiers from pointer target type
include/linux/kernel.h:323:5: note: expected 'char *' but argument is of type 'const char *'
drivers/macintosh/windfarm_smu_sat.c:317:3: warning: passing argument 1 of 'snprintf' discards qualifiers from pointer target type
include/linux/kernel.h:323:5: note: expected 'char *' but argument is of type 'const char *'
Introduced by commit e074d08e2b98 ("powerpc/windfarm: const'ify and add
"priv" field to controls & sensors").
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
drivers/macintosh/windfarm_smu_sat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c
index 72dfe19..e2989ce 100644
--- a/drivers/macintosh/windfarm_smu_sat.c
+++ b/drivers/macintosh/windfarm_smu_sat.c
@@ -287,7 +287,7 @@ static int wf_sat_probe(struct i2c_client *client,
sens->sat = sat;
sens->sens.ops = &wf_sat_ops;
sens->sens.name = (char *) (sens + 1);
- snprintf(sens->sens.name, 16, "%s-%d", name, cpu);
+ snprintf((char *)sens->sens.name, 16, "%s-%d", name, cpu);
if (wf_register_sensor(&sens->sens))
kfree(sens);
@@ -314,7 +314,7 @@ static int wf_sat_probe(struct i2c_client *client,
sens->sat = sat;
sens->sens.ops = &wf_sat_ops;
sens->sens.name = (char *) (sens + 1);
- snprintf(sens->sens.name, 16, "cpu-power-%d", cpu);
+ snprintf((char *)sens->sens.name, 16, "cpu-power-%d", cpu);
if (wf_register_sensor(&sens->sens))
kfree(sens);
--
1.7.10.280.gaa39
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] powerpc/windfarm: don't pass const strings to snprintf
2012-05-03 6:19 [PATCH] powerpc/windfarm: don't pass const strings to snprintf Stephen Rothwell
@ 2012-05-03 10:35 ` David Laight
0 siblings, 0 replies; 2+ messages in thread
From: David Laight @ 2012-05-03 10:35 UTC (permalink / raw)
To: Stephen Rothwell, Benjamin Herrenschmidt; +Cc: ppc-dev
=20
> --- a/drivers/macintosh/windfarm_smu_sat.c
> +++ b/drivers/macintosh/windfarm_smu_sat.c
> @@ -287,7 +287,7 @@ static int wf_sat_probe(struct i2c_client *client,
> sens->sat =3D sat;
> sens->sens.ops =3D &wf_sat_ops;
> sens->sens.name =3D (char *) (sens + 1);
> - snprintf(sens->sens.name, 16, "%s-%d", name, cpu);
> + snprintf((char *)sens->sens.name, 16, "%s-%d", name,
cpu);
> =20
> if (wf_register_sensor(&sens->sens))
> kfree(sens);
Wouldn't it be better to do:
snprintf((char *)(sens + 1), 16, "%s-%d", name, cpu);
David
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-03 10:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-03 6:19 [PATCH] powerpc/windfarm: don't pass const strings to snprintf Stephen Rothwell
2012-05-03 10:35 ` David Laight
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).