pinctrl: samsung: Detect and handle unsupported configuration types

This patch modifies the pinctrl-samsung driver to detect when width of a
bit field is set to zero (which means that such configuraton type is not
supported) and return an error instead of trying to modify an inexistent
register.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Reviewed-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Tomasz Figa 2012-10-11 10:11:07 +02:00 committed by Linus Walleij
parent ddffeb8c4d
commit 7c367d3da6

View file

@ -391,6 +391,9 @@ static int samsung_pinconf_rw(struct pinctrl_dev *pctldev, unsigned int pin,
return -EINVAL;
}
if (!width)
return -EINVAL;
mask = (1 << width) - 1;
shift = pin_offset * width;
data = readl(reg_base + cfg_reg);