[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1363779113-8776-2-git-send-email-richard.genoud@gmail.com>
Date: Wed, 20 Mar 2013 12:31:52 +0100
From: Richard Genoud <richard.genoud@...il.com>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: Axel Lin <axel.lin@...ics.com>,
Stephen Warren <swarren@...dia.com>,
linux-kernel@...r.kernel.org,
Richard Genoud <richard.genoud@...il.com>
Subject: [PATCH] BUG: pinmux: forbid mux_usecount to be set at UINT_MAX
If pin_free is called on a pin already freed, mux_usecount is set to
UINT_MAX which is really a bad idea.
This will silently ignore a double call to pin_free
Signed-off-by: Richard Genoud <richard.genoud@...il.com>
---
drivers/pinctrl/pinmux.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index 917e830..9fd55f9 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -194,8 +194,9 @@ static const char *pin_free(struct pinctrl_dev *pctldev, int pin,
}
if (!gpio_range) {
- desc->mux_usecount--;
- if (desc->mux_usecount)
+ if (1 == desc->mux_usecount)
+ desc->mux_usecount = 0;
+ else
return NULL;
}
--
1.7.2.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists