mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
sh: pfc: Verify pin type encoding size at build time.
The encoding is tightly packed, and future changes (such as pinconf-generic support) can easily lead to a situation where we violate the encoding constraints and trample data bit/reg bits. This plugs in some sanity checks by way of a BUILD_BUG_ON() to blow up if we fail to fit. Signed-off-by: Paul Mundt <[email protected]>
This commit is contained in:
parent
9f65b2b60c
commit
06d5631f56
2 changed files with 19 additions and 9 deletions
|
|
@ -549,6 +549,11 @@ int register_sh_pfc(struct sh_pfc *pfc)
|
|||
int (*initroutine)(struct sh_pfc *) = NULL;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Ensure that the type encoding fits
|
||||
*/
|
||||
BUILD_BUG_ON(PINMUX_FLAG_TYPE > ((1 << PINMUX_FLAG_DBIT_SHIFT) - 1));
|
||||
|
||||
if (sh_pfc)
|
||||
return -EBUSY;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue