* [PATCH] driver/core: Fix various warnings due to dev_set_name() usage
@ 2009-06-17 1:45 Benjamin Herrenschmidt
2009-06-17 2:51 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2009-06-17 1:45 UTC (permalink / raw)
To: Greg KH; +Cc: Linux Kernel list, Linus Torvalds, Andrew Morton
gcc is too smart, we get:
drivers/base/core.c: In function ‘device_add’:
drivers/base/core.c:877: warning: format not a string literal and no format arguments
drivers/base/core.c: In function ‘__root_device_register’:
drivers/base/core.c:1274: warning: format not a string literal and no format arguments
With 4.3.3 and later. This fixes a bunch of them in drivers/base
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
There's still more of these elsewhere in the tree and I may send
patches to fix them some day but for now, this takes care of the
driver core.
Index: linux-work/drivers/base/core.c
===================================================================
--- linux-work.orig/drivers/base/core.c 2009-06-17 11:40:09.000000000 +1000
+++ linux-work/drivers/base/core.c 2009-06-17 11:40:27.000000000 +1000
@@ -874,7 +874,7 @@ int device_add(struct device *dev)
* the name, and force the use of dev_name()
*/
if (dev->init_name) {
- dev_set_name(dev, dev->init_name);
+ dev_set_name(dev, "%s", dev->init_name);
dev->init_name = NULL;
}
@@ -1271,7 +1271,7 @@ struct device *__root_device_register(co
if (!root)
return ERR_PTR(err);
- err = dev_set_name(&root->dev, name);
+ err = dev_set_name(&root->dev, "%s", name);
if (err) {
kfree(root);
return ERR_PTR(err);
Index: linux-work/drivers/base/sys.c
===================================================================
--- linux-work.orig/drivers/base/sys.c 2009-06-17 11:40:39.000000000 +1000
+++ linux-work/drivers/base/sys.c 2009-06-17 11:40:41.000000000 +1000
@@ -138,7 +138,7 @@ int sysdev_class_register(struct sysdev_
cls->kset.kobj.parent = &system_kset->kobj;
cls->kset.kobj.ktype = &ktype_sysdev_class;
cls->kset.kobj.kset = system_kset;
- kobject_set_name(&cls->kset.kobj, cls->name);
+ kobject_set_name(&cls->kset.kobj, "%s", cls->name);
return kset_register(&cls->kset);
}
Index: linux-work/drivers/base/attribute_container.c
===================================================================
--- linux-work.orig/drivers/base/attribute_container.c 2009-06-17 11:43:19.000000000 +1000
+++ linux-work/drivers/base/attribute_container.c 2009-06-17 11:43:22.000000000 +1000
@@ -167,7 +167,7 @@ attribute_container_add_device(struct de
ic->classdev.parent = get_device(dev);
ic->classdev.class = cont->class;
cont->class->dev_release = attribute_container_release;
- dev_set_name(&ic->classdev, dev_name(dev));
+ dev_set_name(&ic->classdev, "%s", dev_name(dev));
if (fn)
fn(cont, dev, &ic->classdev);
else
Index: linux-work/drivers/base/firmware_class.c
===================================================================
--- linux-work.orig/drivers/base/firmware_class.c 2009-06-17 11:43:33.000000000 +1000
+++ linux-work/drivers/base/firmware_class.c 2009-06-17 11:43:38.000000000 +1000
@@ -392,7 +392,7 @@ static int fw_register_device(struct dev
fw_priv->timeout.data = (u_long) fw_priv;
init_timer(&fw_priv->timeout);
- dev_set_name(f_dev, dev_name(device));
+ dev_set_name(f_dev, "%s", dev_name(device));
f_dev->parent = device;
f_dev->class = &firmware_class;
dev_set_drvdata(f_dev, fw_priv);
Index: linux-work/drivers/base/platform.c
===================================================================
--- linux-work.orig/drivers/base/platform.c 2009-06-17 11:43:00.000000000 +1000
+++ linux-work/drivers/base/platform.c 2009-06-17 11:43:02.000000000 +1000
@@ -244,7 +244,7 @@ int platform_device_add(struct platform_
if (pdev->id != -1)
dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
else
- dev_set_name(&pdev->dev, pdev->name);
+ dev_set_name(&pdev->dev, "%s", pdev->name);
for (i = 0; i < pdev->num_resources; i++) {
struct resource *p, *r = &pdev->resource[i];
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] driver/core: Fix various warnings due to dev_set_name() usage
2009-06-17 1:45 [PATCH] driver/core: Fix various warnings due to dev_set_name() usage Benjamin Herrenschmidt
@ 2009-06-17 2:51 ` Greg KH
2009-06-17 4:06 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2009-06-17 2:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Linux Kernel list, Linus Torvalds, Andrew Morton
On Wed, Jun 17, 2009 at 11:45:50AM +1000, Benjamin Herrenschmidt wrote:
> gcc is too smart, we get:
>
> drivers/base/core.c: In function ‘device_add’:
> drivers/base/core.c:877: warning: format not a string literal and no format arguments
> drivers/base/core.c: In function ‘__root_device_register’:
> drivers/base/core.c:1274: warning: format not a string literal and no format arguments
>
> With 4.3.3 and later. This fixes a bunch of them in drivers/base
These have all been fixed in linux-next for a while, and are already
contained in the patchset I sent to Linus for inclusion in his tree
yesterday.
But thanks anyway :)
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] driver/core: Fix various warnings due to dev_set_name() usage
2009-06-17 2:51 ` Greg KH
@ 2009-06-17 4:06 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2009-06-17 4:06 UTC (permalink / raw)
To: Greg KH; +Cc: Linux Kernel list, Linus Torvalds, Andrew Morton
On Tue, 2009-06-16 at 19:51 -0700, Greg KH wrote:
>
> These have all been fixed in linux-next for a while, and are already
> contained in the patchset I sent to Linus for inclusion in his tree
> yesterday.
>
> But thanks anyway :)
Argh, oh well ... I should have waited one more day :-)
Cheers,
Ben.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-17 4:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-17 1:45 [PATCH] driver/core: Fix various warnings due to dev_set_name() usage Benjamin Herrenschmidt
2009-06-17 2:51 ` Greg KH
2009-06-17 4:06 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox