Skip to contentSkip to conversation

hpet: Make cmd parameter of hpet_ioctl_common() unsigned

PATCH In review Matthias Kaehlcke 4 participants 5 messages Mar 13, 2017 – Mar 24, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hpet: Make cmd parameter of hpet_ioctl_common() unsigned

The value passed by the two callers of the function is unsigned anyway.

Making the parameter unsigned fixes the following warning when building with clang:

drivers/char/hpet.c:588:7: error: overflow converting case value to switch condition type (2149083139 to 18446744071563667459) [-Werror,-Wswitch]

        case HPET_INFO:
             ^
include/uapi/linux/hpet.h:18:19: note: expanded from macro 'HPET_INFO'
                        ^
include/uapi/asm-generic/ioctl.h:77:28: note: expanded from macro '_IOR'
                                ^
include/uapi/asm-generic/ioctl.h:66:2: note: expanded from macro '_IOC'
        (((dir)  << _IOC_DIRSHIFT) | \
---
 drivers/char/hpet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/hpet.c +1 -1
index 20b32bb8c2af..0d633b76c29e 100644
@@ -574,7 +574,7 @@ static inline unsigned long hpet_time_div(struct hpets *hpets,
 }
 
 static int
-hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg,
+hpet_ioctl_common(struct hpet_dev *devp, unsigned int cmd, unsigned long arg,
 		  struct hpet_info *info)
 {
 	struct hpet_timer __iomem *timer;
Signature · 1 line
2.12.0.246.ga2ecc84866-goog
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 1 line · Matthias Kaehlcke

The value passed by the two callers of the function is unsigned anyway.

Indeed; and those are just simple wrappers.

Quoted 13 lines

Making the parameter unsigned fixes the following warning when building with clang:

drivers/char/hpet.c:588:7: error: overflow converting case value to switch condition type (2149083139 to 18446744071563667459) [-Werror,-Wswitch]

        case HPET_INFO:
             ^
include/uapi/linux/hpet.h:18:19: note: expanded from macro 'HPET_INFO'
                        ^
include/uapi/asm-generic/ioctl.h:77:28: note: expanded from macro '_IOR'
                                ^
include/uapi/asm-generic/ioctl.h:66:2: note: expanded from macro '_IOC'
        (((dir)  << _IOC_DIRSHIFT) | \
Quoted 1 line
Quoted 17 lines
---
 drivers/char/hpet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/hpet.c +1 -1
index 20b32bb8c2af..0d633b76c29e 100644
@@ -574,7 +574,7 @@ static inline unsigned long hpet_time_div(struct hpets *hpets,
 }
 
 static int
-hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg,
+hpet_ioctl_common(struct hpet_dev *devp, unsigned int cmd, unsigned long arg,
 		  struct hpet_info *info)
 {
 	struct hpet_timer __iomem *timer;
#2 lore raw
Quoted 18 lines · Clemens Ladisch
Quoted 1 line · Matthias Kaehlcke

The value passed by the two callers of the function is unsigned anyway.

Indeed; and those are just simple wrappers.

Quoted 13 lines

Making the parameter unsigned fixes the following warning when building with clang:

drivers/char/hpet.c:588:7: error: overflow converting case value to switch condition type (2149083139 to 18446744071563667459) [-Werror,-Wswitch]

        case HPET_INFO:
             ^
include/uapi/linux/hpet.h:18:19: note: expanded from macro 'HPET_INFO'
                        ^
include/uapi/asm-generic/ioctl.h:77:28: note: expanded from macro '_IOR'
                                ^
include/uapi/asm-generic/ioctl.h:66:2: note: expanded from macro '_IOC'
        (((dir)  << _IOC_DIRSHIFT) | \
Quoted 3 lines
Quoted 1 line

Any other feedback on this patch?
Or has this already been added to someone's "for-linus" branch?

just looking for update on patch status.

cheers,
grant

Quoted 18 lines
Quoted 18 lines
---
 drivers/char/hpet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/hpet.c +1 -1
index 20b32bb8c2af..0d633b76c29e 100644
@@ -574,7 +574,7 @@ static inline unsigned long hpet_time_div(struct hpets *hpets,
 }
 
 static int
-hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg,
+hpet_ioctl_common(struct hpet_dev *devp, unsigned int cmd, unsigned long arg,
                struct hpet_info *info)
 {
      struct hpet_timer __iomem *timer;
#3 lore raw
Quoted 19 lines · Grant Grundler
Quoted 18 lines · Clemens Ladisch
Quoted 1 line · Matthias Kaehlcke

The value passed by the two callers of the function is unsigned anyway.

Indeed; and those are just simple wrappers.

Quoted 13 lines

Making the parameter unsigned fixes the following warning when building with clang:

drivers/char/hpet.c:588:7: error: overflow converting case value to switch condition type (2149083139 to 18446744071563667459) [-Werror,-Wswitch]

        case HPET_INFO:
             ^
include/uapi/linux/hpet.h:18:19: note: expanded from macro 'HPET_INFO'
                        ^
include/uapi/asm-generic/ioctl.h:77:28: note: expanded from macro '_IOR'
                                ^
include/uapi/asm-generic/ioctl.h:66:2: note: expanded from macro '_IOC'
        (((dir)  << _IOC_DIRSHIFT) | \
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Any other feedback on this patch?
Or has this already been added to someone's "for-linus" branch?

just looking for update on patch status.

This is already in my -next branch, to go into 4.12-rc1. Should it get into 4.11-final instead?

thanks,

greg k-h

#4 lore raw
Quoted 24 lines · Greg Kroah-Hartman
Quoted 23 lines · Grant Grundler
Quoted 21 lines · Clemens Ladisch
Quoted 1 line · Matthias Kaehlcke

The value passed by the two callers of the function is unsigned anyway.

Indeed; and those are just simple wrappers.

Quoted 13 lines

Making the parameter unsigned fixes the following warning when building with clang:

drivers/char/hpet.c:588:7: error: overflow converting case value to switch condition type (2149083139 to 18446744071563667459) [-Werror,-Wswitch]

        case HPET_INFO:
             ^
include/uapi/linux/hpet.h:18:19: note: expanded from macro 'HPET_INFO'
                        ^
include/uapi/asm-generic/ioctl.h:77:28: note: expanded from macro '_IOR'
                                ^
include/uapi/asm-generic/ioctl.h:66:2: note: expanded from macro '_IOC'
        (((dir)  << _IOC_DIRSHIFT) | \
Quoted 1 line
Quoted 7 lines
Quoted 4 lines

Any other feedback on this patch?
Or has this already been added to someone's "for-linus" branch?

just looking for update on patch status.

This is already in my -next branch, to go into 4.12-rc1. Should it get into 4.11-final instead?

I would say "no" since 4.12-rc1 is good enough for me. Thanks! :)

cheers,
grant

Quoted 4 lines

thanks,

greg k-h