diff options
author | Abylay Ospan <aospan@netup.ru> | 2015-09-25 03:56:21 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-10-22 13:48:26 -0400 |
commit | 9d2b064c0ae42ad93b2a0c7da05daef312c96bcc (patch) | |
tree | 27ca04ceb597ec5d3abccf8940666350ea2033eb /drivers/media/pci/netup_unidvb/netup_unidvb_spi.c | |
parent | 47810b4341ac9d2f558894bc5995e6fa2a1298f9 (diff) |
[media] netup_unidvb: fix potential crash when spi is NULL
Signed-off-by: Abylay Ospan <aospan@netup.ru>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/pci/netup_unidvb/netup_unidvb_spi.c')
-rw-r--r-- | drivers/media/pci/netup_unidvb/netup_unidvb_spi.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c b/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c index f55b3276f28d..56773f3893d4 100644 --- a/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c +++ b/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c | |||
@@ -80,11 +80,9 @@ irqreturn_t netup_spi_interrupt(struct netup_spi *spi) | |||
80 | u16 reg; | 80 | u16 reg; |
81 | unsigned long flags; | 81 | unsigned long flags; |
82 | 82 | ||
83 | if (!spi) { | 83 | if (!spi) |
84 | dev_dbg(&spi->master->dev, | ||
85 | "%s(): SPI not initialized\n", __func__); | ||
86 | return IRQ_NONE; | 84 | return IRQ_NONE; |
87 | } | 85 | |
88 | spin_lock_irqsave(&spi->lock, flags); | 86 | spin_lock_irqsave(&spi->lock, flags); |
89 | reg = readw(&spi->regs->control_stat); | 87 | reg = readw(&spi->regs->control_stat); |
90 | if (!(reg & NETUP_SPI_CTRL_IRQ)) { | 88 | if (!(reg & NETUP_SPI_CTRL_IRQ)) { |
@@ -234,11 +232,9 @@ void netup_spi_release(struct netup_unidvb_dev *ndev) | |||
234 | unsigned long flags; | 232 | unsigned long flags; |
235 | struct netup_spi *spi = ndev->spi; | 233 | struct netup_spi *spi = ndev->spi; |
236 | 234 | ||
237 | if (!spi) { | 235 | if (!spi) |
238 | dev_dbg(&spi->master->dev, | ||
239 | "%s(): SPI not initialized\n", __func__); | ||
240 | return; | 236 | return; |
241 | } | 237 | |
242 | spin_lock_irqsave(&spi->lock, flags); | 238 | spin_lock_irqsave(&spi->lock, flags); |
243 | reg = readw(&spi->regs->control_stat); | 239 | reg = readw(&spi->regs->control_stat); |
244 | writew(reg | NETUP_SPI_CTRL_IRQ, &spi->regs->control_stat); | 240 | writew(reg | NETUP_SPI_CTRL_IRQ, &spi->regs->control_stat); |