* [PATCH -next] sysfs: add unsigned long cast to prevent compile warning
@ 2011-09-22 7:15 Heiko Carstens
2011-09-22 14:16 ` Mikulas Patocka
0 siblings, 1 reply; 3+ messages in thread
From: Heiko Carstens @ 2011-09-22 7:15 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-next, Heiko Carstens, Mikulas Patocka
"sysfs: use rb-tree for inode number lookup" added a new printk which
causes a new compile warning on s390 (and few other architectures):
fs/sysfs/dir.c: In function 'sysfs_link_sibling':
fs/sysfs/dir.c:63:4: warning: format '%lx' expects argument of type
'long unsigned int', but argument 2 has type 'ino_t' [-Wform
Add an explicit unsigned long cast since ino_t is an unsigned long on
most architectures.
Cc: Mikulas Patocka <mpatocka@redhat•com>
Signed-off-by: Heiko Carstens <heiko.carstens@de•ibm.com>
---
fs/sysfs/dir.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index c3646d9..9a6e020 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -60,7 +60,8 @@ static void sysfs_link_sibling(struct sysfs_dirent *sd)
} else if (sd->s_ino > node->s_ino) {
p = &node->inode_node.rb_right;
} else {
- printk(KERN_CRIT "sysfs: inserting duplicate inode '%lx'\n", sd->s_ino);
+ printk(KERN_CRIT "sysfs: inserting duplicate inode '%lux'\n",
+ (unsigned long) sd->s_ino);
BUG();
}
#undef node
--
1.7.5.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] sysfs: add unsigned long cast to prevent compile warning
2011-09-22 7:15 [PATCH -next] sysfs: add unsigned long cast to prevent compile warning Heiko Carstens
@ 2011-09-22 14:16 ` Mikulas Patocka
2011-09-22 17:34 ` Heiko Carstens
0 siblings, 1 reply; 3+ messages in thread
From: Mikulas Patocka @ 2011-09-22 14:16 UTC (permalink / raw)
To: Heiko Carstens; +Cc: Greg Kroah-Hartman, linux-next
Hi
> "sysfs: use rb-tree for inode number lookup" added a new printk which
> causes a new compile warning on s390 (and few other architectures):
>
> fs/sysfs/dir.c: In function 'sysfs_link_sibling':
> fs/sysfs/dir.c:63:4: warning: format '%lx' expects argument of type
> 'long unsigned int', but argument 2 has type 'ino_t' [-Wform
>
> Add an explicit unsigned long cast since ino_t is an unsigned long on
> most architectures.
>
> Cc: Mikulas Patocka <mpatocka@redhat•com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de•ibm.com>
> ---
> fs/sysfs/dir.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
> index c3646d9..9a6e020 100644
> --- a/fs/sysfs/dir.c
> +++ b/fs/sysfs/dir.c
> @@ -60,7 +60,8 @@ static void sysfs_link_sibling(struct sysfs_dirent *sd)
> } else if (sd->s_ino > node->s_ino) {
> p = &node->inode_node.rb_right;
> } else {
> - printk(KERN_CRIT "sysfs: inserting duplicate inode '%lx'\n", sd->s_ino);
> + printk(KERN_CRIT "sysfs: inserting duplicate inode '%lux'\n",
This change is wrong. Leave the format string as it was ... "%lux"
actually prints a decimal long unsigned integer followed by the character
"x". "%lx" prints the hexadecimal unsigned long string.
> + (unsigned long) sd->s_ino);
OK, this is good.
> BUG();
> }
> #undef node
> --
> 1.7.5.4
Mikulas
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] sysfs: add unsigned long cast to prevent compile warning
2011-09-22 14:16 ` Mikulas Patocka
@ 2011-09-22 17:34 ` Heiko Carstens
0 siblings, 0 replies; 3+ messages in thread
From: Heiko Carstens @ 2011-09-22 17:34 UTC (permalink / raw)
To: Mikulas Patocka; +Cc: Greg Kroah-Hartman, linux-next
On Thu, Sep 22, 2011 at 10:16:51AM -0400, Mikulas Patocka wrote:
> > - printk(KERN_CRIT "sysfs: inserting duplicate inode '%lx'\n", sd->s_ino);
> > + printk(KERN_CRIT "sysfs: inserting duplicate inode '%lux'\n",
>
> This change is wrong. Leave the format string as it was ... "%lux"
> actually prints a decimal long unsigned integer followed by the character
> "x". "%lx" prints the hexadecimal unsigned long string.
Indeed.. I wanted to change it to %lu (so it matches other places which
print an inode) but obviously didn't manage to remove the "x".
So let's just keep it. Updated patch:
Subject: [PATCH] sysfs: add unsigned long cast to prevent compile warning
From: Heiko Carstens <heiko.carstens@de•ibm.com>
"sysfs: use rb-tree for inode number lookup" added a new printk which
causes a new compile warning on s390 (and few other architectures):
fs/sysfs/dir.c: In function 'sysfs_link_sibling':
fs/sysfs/dir.c:63:4: warning: format '%lx' expects argument of type
'long unsigned int', but argument 2 has type 'ino_t' [-Wform
Add an explicit unsigned long cast since ino_t is an unsigned long on
most architectures.
Cc: Mikulas Patocka <mpatocka@redhat•com>
Signed-off-by: Heiko Carstens <heiko.carstens@de•ibm.com>
---
fs/sysfs/dir.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index c3646d9..83bb9d1 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -60,7 +60,8 @@ static void sysfs_link_sibling(struct sysfs_dirent *sd)
} else if (sd->s_ino > node->s_ino) {
p = &node->inode_node.rb_right;
} else {
- printk(KERN_CRIT "sysfs: inserting duplicate inode '%lx'\n", sd->s_ino);
+ printk(KERN_CRIT "sysfs: inserting duplicate inode '%lx'\n",
+ (unsigned long) sd->s_ino);
BUG();
}
#undef node
--
1.7.5.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-09-22 17:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-22 7:15 [PATCH -next] sysfs: add unsigned long cast to prevent compile warning Heiko Carstens
2011-09-22 14:16 ` Mikulas Patocka
2011-09-22 17:34 ` Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox