aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpio/timbgpio.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/gpio/timbgpio.c b/drivers/gpio/timbgpio.c
index ac4d0f0ea02b..ddd053108a13 100644
--- a/drivers/gpio/timbgpio.c
+++ b/drivers/gpio/timbgpio.c
@@ -131,6 +131,7 @@ static int timbgpio_irq_type(unsigned irq, unsigned trigger)
131 unsigned long flags; 131 unsigned long flags;
132 u32 lvr, flr, bflr = 0; 132 u32 lvr, flr, bflr = 0;
133 u32 ver; 133 u32 ver;
134 int ret = 0;
134 135
135 if (offset < 0 || offset > tgpio->gpio.ngpio) 136 if (offset < 0 || offset > tgpio->gpio.ngpio)
136 return -EINVAL; 137 return -EINVAL;
@@ -154,8 +155,10 @@ static int timbgpio_irq_type(unsigned irq, unsigned trigger)
154 } 155 }
155 156
156 if ((trigger & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) { 157 if ((trigger & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) {
157 if (ver < 3) 158 if (ver < 3) {
158 return -EINVAL; 159 ret = -EINVAL;
160 goto out;
161 }
159 else { 162 else {
160 flr |= 1 << offset; 163 flr |= 1 << offset;
161 bflr |= 1 << offset; 164 bflr |= 1 << offset;
@@ -175,9 +178,10 @@ static int timbgpio_irq_type(unsigned irq, unsigned trigger)
175 iowrite32(bflr, tgpio->membase + TGPIO_BFLR); 178 iowrite32(bflr, tgpio->membase + TGPIO_BFLR);
176 179
177 iowrite32(1 << offset, tgpio->membase + TGPIO_ICR); 180 iowrite32(1 << offset, tgpio->membase + TGPIO_ICR);
178 spin_unlock_irqrestore(&tgpio->lock, flags);
179 181
180 return 0; 182out:
183 spin_unlock_irqrestore(&tgpio->lock, flags);
184 return ret;
181} 185}
182 186
183static void timbgpio_irq(unsigned int irq, struct irq_desc *desc) 187static void timbgpio_irq(unsigned int irq, struct irq_desc *desc)