Skip to contentSkip to conversation

serio: avoid negative serio device numbers

PATCH Applied Richard Leitner 2 participants 2 messages Oct 8, 2014

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

PATCH 1/1 serio: avoid negative serio device numbers

From: Richard Leitner <[email protected]>

Fix the format string for serio device name generation to avoid negative device numbers when the id exceeds the maximum signed integer value.

---
 drivers/input/serio/serio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/serio/serio.c +2 -2
index b29134d..d399b8b 100644
@@ -524,8 +524,8 @@ static void serio_init_port(struct serio *serio)
 	spin_lock_init(&serio->lock);
 	mutex_init(&serio->drv_mutex);
 	device_initialize(&serio->dev);
-	dev_set_name(&serio->dev, "serio%ld",
-			(long)atomic_inc_return(&serio_no) - 1);
+	dev_set_name(&serio->dev, "serio%lu",
+		     (unsigned long)atomic_inc_return(&serio_no) - 1);
 	serio->dev.bus = &serio_bus;
 	serio->dev.release = serio_release_port;
 	serio->dev.groups = serio_device_attr_groups;
Signature · 1 line
2.1.1
maintainer Applied
#1 lore raw
Quoted 6 lines · Richard Leitner

From: Richard Leitner <[email protected]>

Fix the format string for serio device name generation to avoid negative device numbers when the id exceeds the maximum signed integer value.

Applied, thank you.

Quoted 22 lines
---
 drivers/input/serio/serio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/serio/serio.c +2 -2
index b29134d..d399b8b 100644
@@ -524,8 +524,8 @@ static void serio_init_port(struct serio *serio)
 	spin_lock_init(&serio->lock);
 	mutex_init(&serio->drv_mutex);
 	device_initialize(&serio->dev);
-	dev_set_name(&serio->dev, "serio%ld",
-			(long)atomic_inc_return(&serio_no) - 1);
+	dev_set_name(&serio->dev, "serio%lu",
+		     (unsigned long)atomic_inc_return(&serio_no) - 1);
 	serio->dev.bus = &serio_bus;
 	serio->dev.release = serio_release_port;
 	serio->dev.groups = serio_device_attr_groups;
Signature · 1 line
2.1.1
Signature · 1 line
Dmitry