Commit 243ba2fa authored by Jesper Nilsson's avatar Jesper Nilsson

CRIS: Check if pointer is set before using it

Signed-off-by: default avatarJesper Nilsson <jesper.nilsson@axis.com>
parent a3af54ff
...@@ -46,10 +46,12 @@ static inline void crisv32_io_set(struct crisv32_iopin *iopin, int val) ...@@ -46,10 +46,12 @@ static inline void crisv32_io_set(struct crisv32_iopin *iopin, int val)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&iopin->port->lock, flags); spin_lock_irqsave(&iopin->port->lock, flags);
if (val) if (iopin->port->data) {
*iopin->port->data |= iopin->bit; if (val)
else *iopin->port->data |= iopin->bit;
*iopin->port->data &= ~iopin->bit; else
*iopin->port->data &= ~iopin->bit;
}
spin_unlock_irqrestore(&iopin->port->lock, flags); spin_unlock_irqrestore(&iopin->port->lock, flags);
} }
...@@ -60,10 +62,12 @@ static inline void crisv32_io_set_dir(struct crisv32_iopin* iopin, ...@@ -60,10 +62,12 @@ static inline void crisv32_io_set_dir(struct crisv32_iopin* iopin,
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&iopin->port->lock, flags); spin_lock_irqsave(&iopin->port->lock, flags);
if (dir == crisv32_io_dir_in) if (iopin->port->oe) {
*iopin->port->oe &= ~iopin->bit; if (dir == crisv32_io_dir_in)
else *iopin->port->oe &= ~iopin->bit;
*iopin->port->oe |= iopin->bit; else
*iopin->port->oe |= iopin->bit;
}
spin_unlock_irqrestore(&iopin->port->lock, flags); spin_unlock_irqrestore(&iopin->port->lock, flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment