Skip to content

Commit

Permalink
pinctrl: samsung: Detect and handle unsupported configuration types
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tomasz Figa authored and Linus Walleij committed Oct 15, 2012
1 parent ddffeb8 commit 7c367d3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/pinctrl/pinctrl-samsung.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7c367d3

Please sign in to comment.