Skip to contentSkip to conversation

mfd: dereferencing first then checking

DISCUSSION Dan Carpenter 2 participants 2 messages Mar 8, 2010 – Mar 19, 2010 Kernel janitors

lore
Share & tools
lore
#0 lore raw

drivers/mfd/t7l66xb.c +371 t7l66xb_probe(58) warn: variable dereferenced before check 'pdata'
338 t7l66xb->irq_base = pdata->irq_base;

[snip]

   371          if (pdata && pdata->enable)
   372                  pdata->enable(dev);

Can pdata be null here? We dereferenced on line 338 without checking.

regards,
dan carpenter

#1 lore raw

Hi Dan,

Quoted 9 lines · Dan Carpenter

drivers/mfd/t7l66xb.c +371 t7l66xb_probe(58) warn: variable dereferenced before check 'pdata'
338 t7l66xb->irq_base = pdata->irq_base;

   [snip]

   371          if (pdata && pdata->enable)
   372                  pdata->enable(dev);

Can pdata be null here? We dereferenced on line 338 without checking.

We should definitely check for pdata being not NULL here. I fixed that, thanks for spotting it.

Cheers,
Samuel.

Quoted 2 lines

regards,
dan carpenter

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/