cxd56_dmac, lcd_dev: fix null pointer dereference
Check return values of following functions for null: - board_lcd_getdev - get_device Signed-off-by: Mingjie Shen <shen497@purdue.edu>
This commit is contained in:
parent
5b00c31396
commit
1d6e51220d
|
@ -400,6 +400,12 @@ static void _dmac_intc_handler(int ch)
|
|||
int itc;
|
||||
int err;
|
||||
|
||||
if (dev == NULL)
|
||||
{
|
||||
dmaerr("Cannot get device with channel number %d.\n", ch);
|
||||
return;
|
||||
}
|
||||
|
||||
mask = (1u << (ch & 1));
|
||||
|
||||
if (is_dmac(2, dev))
|
||||
|
@ -442,9 +448,16 @@ static int intr_handler_admac1(int irq, void *context, void *arg)
|
|||
static int intr_handler_idmac(int irq, void *context, void *arg)
|
||||
{
|
||||
struct dmac_register_map *dev = get_device(2); /* XXX */
|
||||
uint32_t stat = dev->intstatus & 0x1f;
|
||||
uint32_t stat;
|
||||
int i;
|
||||
|
||||
if (dev == NULL)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
stat = dev->intstatus & 0x1f;
|
||||
|
||||
for (i = 2; stat; i++, stat >>= 1)
|
||||
{
|
||||
if (stat & 1)
|
||||
|
|
|
@ -315,6 +315,12 @@ int lcddev_register(int devno)
|
|||
}
|
||||
|
||||
priv->lcd_ptr = board_lcd_getdev(devno);
|
||||
if (!priv->lcd_ptr)
|
||||
{
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = priv->lcd_ptr->getplaneinfo(priv->lcd_ptr, 0, &priv->planeinfo);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue