diff options
author | Jesper Nilsson <jesper.nilsson@axis.com> | 2010-08-03 18:50:06 +0200 |
---|---|---|
committer | Jesper Nilsson <jesper.nilsson@axis.com> | 2010-08-04 13:02:34 +0200 |
commit | 243ba2fa461a22e01e5905dd299babeaeeb418e2 (patch) | |
tree | baa0b1c9c26ab875b29d7aec3f2a198ecbfa2fb7 /arch/cris/include | |
parent | CRIS: Machine dependent dma.h (diff) | |
download | linux-243ba2fa461a22e01e5905dd299babeaeeb418e2.tar.xz linux-243ba2fa461a22e01e5905dd299babeaeeb418e2.zip |
CRIS: Check if pointer is set before using it
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
Diffstat (limited to 'arch/cris/include')
-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) 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); } |