All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Greg KH <greg@kroah.com>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] driver/core: Fix various warnings due to dev_set_name() usage
Date: Wed, 17 Jun 2009 11:45:50 +1000	[thread overview]
Message-ID: <1245203150.21602.10.camel@pasglop> (raw)

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];



             reply	other threads:[~2009-06-17  1:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-17  1:45 Benjamin Herrenschmidt [this message]
2009-06-17  2:51 ` [PATCH] driver/core: Fix various warnings due to dev_set_name() usage Greg KH
2009-06-17  4:06   ` Benjamin Herrenschmidt

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=1245203150.21602.10.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=akpm@linux-foundation.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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.