Skip to contentSkip to conversation

pinctrl: remove an unnecessary cast

PATCH In review Dan Carpenter 2 participants 2 messages Sep 17, 2013 – Sep 23, 2013

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

PATCH 1/1 pinctrl: remove an unnecessary cast

sizeof() is already size_t so there is no need to cast here. Generally, casting inside the min() macro instead of using min_t() is considered bad style.

drivers/pinctrl/pinconf.c +1 -1
index a138965..abe66d4 100644
@@ -508,7 +508,7 @@ static int pinconf_dbg_config_write(struct file *file,
 	int i;
 
 	/* Get userspace string and assure termination */
-	buf_size = min(count, (size_t)(sizeof(buf)-1));
+	buf_size = min(count, sizeof(buf) - 1);
 	if (copy_from_user(buf, user_buf, buf_size))
 		return -EFAULT;
 	buf[buf_size] = 0;
#1 lore raw
Quoted 5 lines · Dan Carpenter

sizeof() is already size_t so there is no need to cast here. Generally, casting inside the min() macro instead of using min_t() is considered bad style.

Patch applied!

Thanks,
Linus Walleij