Skip to content

Commit

Permalink
[media] netup_unidvb: fix potential crash when spi is NULL
Browse files Browse the repository at this point in the history
Signed-off-by: Abylay Ospan <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
aospan authored and mchehab committed Oct 22, 2015
1 parent 47810b4 commit 9d2b064
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions drivers/media/pci/netup_unidvb/netup_unidvb_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,9 @@ irqreturn_t netup_spi_interrupt(struct netup_spi *spi)
u16 reg;
unsigned long flags;

if (!spi) {
dev_dbg(&spi->master->dev,
"%s(): SPI not initialized\n", __func__);
if (!spi)
return IRQ_NONE;
}

spin_lock_irqsave(&spi->lock, flags);
reg = readw(&spi->regs->control_stat);
if (!(reg & NETUP_SPI_CTRL_IRQ)) {
Expand Down Expand Up @@ -234,11 +232,9 @@ void netup_spi_release(struct netup_unidvb_dev *ndev)
unsigned long flags;
struct netup_spi *spi = ndev->spi;

if (!spi) {
dev_dbg(&spi->master->dev,
"%s(): SPI not initialized\n", __func__);
if (!spi)
return;
}

spin_lock_irqsave(&spi->lock, flags);
reg = readw(&spi->regs->control_stat);
writew(reg | NETUP_SPI_CTRL_IRQ, &spi->regs->control_stat);
Expand Down

0 comments on commit 9d2b064

Please sign in to comment.