CRIS: Check if pointer is set before using it
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
This commit is contained in:
parent
a3af54ffa9
commit
243ba2fa46
1 changed files with 12 additions and 8 deletions
|
@ -46,10 +46,12 @@ static inline void crisv32_io_set(struct crisv32_iopin *iopin, int val)
|
|||
unsigned long flags;
|
||||
spin_lock_irqsave(&iopin->port->lock, flags);
|
||||
|
||||
if (val)
|
||||
*iopin->port->data |= iopin->bit;
|
||||
else
|
||||
*iopin->port->data &= ~iopin->bit;
|
||||
if (iopin->port->data) {
|
||||
if (val)
|
||||
*iopin->port->data |= iopin->bit;
|
||||
else
|
||||
*iopin->port->data &= ~iopin->bit;
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&iopin->port->lock, flags);
|
||||
}
|
||||
|
@ -60,10 +62,12 @@ static inline void crisv32_io_set_dir(struct crisv32_iopin* iopin,
|
|||
unsigned long flags;
|
||||
spin_lock_irqsave(&iopin->port->lock, flags);
|
||||
|
||||
if (dir == crisv32_io_dir_in)
|
||||
*iopin->port->oe &= ~iopin->bit;
|
||||
else
|
||||
*iopin->port->oe |= iopin->bit;
|
||||
if (iopin->port->oe) {
|
||||
if (dir == crisv32_io_dir_in)
|
||||
*iopin->port->oe &= ~iopin->bit;
|
||||
else
|
||||
*iopin->port->oe |= iopin->bit;
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&iopin->port->lock, flags);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue