Skip to content

Commit

Permalink
CRIS: Check if pointer is set before using it
Browse files Browse the repository at this point in the history
Signed-off-by: Jesper Nilsson <[email protected]>
  • Loading branch information
jniax committed Aug 4, 2010
1 parent a3af54f commit 243ba2f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions arch/cris/include/arch-v32/arch/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit 243ba2f

Please sign in to comment.