From: Tomasz Figa Date: Thu, 11 Oct 2012 08:11:07 +0000 (+0200) Subject: pinctrl: samsung: Detect and handle unsupported configuration types X-Git-Tag: v3.8-rc1~143^2~5^2~3^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7c367d3da697846b80058859937f606c0081beda;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git 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 Reviewed-by: Kyungmin Park Acked-by: Thomas Abraham Signed-off-by: Linus Walleij --- diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c index dd108a9..c660fa5 100644 --- a/drivers/pinctrl/pinctrl-samsung.c +++ b/drivers/pinctrl/pinctrl-samsung.c @@ -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);