diff options
author | Jesper Nilsson <jesper.nilsson@axis.com> | 2010-08-03 12:50:06 -0400 |
---|---|---|
committer | Jesper Nilsson <jesper.nilsson@axis.com> | 2010-08-04 07:02:34 -0400 |
commit | 243ba2fa461a22e01e5905dd299babeaeeb418e2 (patch) | |
tree | baa0b1c9c26ab875b29d7aec3f2a198ecbfa2fb7 | |
parent | a3af54ffa9fb0e3ce66904bd316f079cafad1bd5 (diff) |
CRIS: Check if pointer is set before using it
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
-rw-r--r-- | arch/cris/include/arch-v32/arch/io.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/arch/cris/include/arch-v32/arch/io.h b/arch/cris/include/arch-v32/arch/io.h index 72024452cea9..adc5484351bf 100644 --- a/arch/cris/include/arch-v32/arch/io.h +++ b/arch/cris/include/arch-v32/arch/io.h | |||
@@ -46,10 +46,12 @@ static inline void crisv32_io_set(struct crisv32_iopin *iopin, int val) | |||
46 | unsigned long flags; | 46 | unsigned long flags; |
47 | spin_lock_irqsave(&iopin->port->lock, flags); | 47 | spin_lock_irqsave(&iopin->port->lock, flags); |
48 | 48 | ||
49 | if (val) | 49 | if (iopin->port->data) { |
50 | *iopin->port->data |= iopin->bit; | 50 | if (val) |
51 | else | 51 | *iopin->port->data |= iopin->bit; |
52 | *iopin->port->data &= ~iopin->bit; | 52 | else |
53 | *iopin->port->data &= ~iopin->bit; | ||
54 | } | ||
53 | 55 | ||
54 | spin_unlock_irqrestore(&iopin->port->lock, flags); | 56 | spin_unlock_irqrestore(&iopin->port->lock, flags); |
55 | } | 57 | } |
@@ -60,10 +62,12 @@ static inline void crisv32_io_set_dir(struct crisv32_iopin* iopin, | |||
60 | unsigned long flags; | 62 | unsigned long flags; |
61 | spin_lock_irqsave(&iopin->port->lock, flags); | 63 | spin_lock_irqsave(&iopin->port->lock, flags); |
62 | 64 | ||
63 | if (dir == crisv32_io_dir_in) | 65 | if (iopin->port->oe) { |
64 | *iopin->port->oe &= ~iopin->bit; | 66 | if (dir == crisv32_io_dir_in) |
65 | else | 67 | *iopin->port->oe &= ~iopin->bit; |
66 | *iopin->port->oe |= iopin->bit; | 68 | else |
69 | *iopin->port->oe |= iopin->bit; | ||
70 | } | ||
67 | 71 | ||
68 | spin_unlock_irqrestore(&iopin->port->lock, flags); | 72 | spin_unlock_irqrestore(&iopin->port->lock, flags); |
69 | } | 73 | } |