summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorTomasz Figa <t.figa@samsung.com>2012-10-11 10:11:07 +0200
committerLinus Walleij <linus.walleij@linaro.org>2012-10-15 09:10:10 +0200
commit7c367d3da697846b80058859937f606c0081beda (patch)
tree4038a22fa5ef2a0d1ae6d2da9a6afb7e38b39278 /drivers/pinctrl
parentddffeb8c4d0331609ef2581d84de4d763607bd37 (diff)
downloadlinux-7c367d3da697846b80058859937f606c0081beda.tar.gz
linux-7c367d3da697846b80058859937f606c0081beda.tar.bz2
linux-7c367d3da697846b80058859937f606c0081beda.zip
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>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/pinctrl-samsung.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c
index dd108a94acf9..c660fa5071d7 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);