Commit ddb6b26c authored by Lee Jones's avatar Lee Jones
Browse files

mfd: ab8500-debugfs: Fix incompatible types in comparison expression issue



Smatch reports:

 drivers/mfd/ab8500-debugfs.c:1804:20: error: incompatible types in comparison expression (different type sizes):
 drivers/mfd/ab8500-debugfs.c:1804:20:    unsigned int *
 drivers/mfd/ab8500-debugfs.c:1804:20:    unsigned long *

This is due to mixed types being compared in a min() comparison.  Fix
this by treating values as signed and casting them to the same type
as the receiving variable.

Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 54daa5d4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1801,7 +1801,7 @@ static ssize_t ab8500_hwreg_write(struct file *file,
	int buf_size, ret;

	/* Get userspace string and assure termination */
	buf_size = min(count, (sizeof(buf)-1));
	buf_size = min((int)count, (int)(sizeof(buf)-1));
	if (copy_from_user(buf, user_buf, buf_size))
		return -EFAULT;
	buf[buf_size] = 0;