dect
/
linux-2.6
Archived
13
0
Fork 0

mfd: sta2x11: Fix potential NULL pointer dereference in __sta2x11_mfd_mask()

The dereference to 'mfd' should be moved below the NULL test.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Wei Yongjun 2012-12-02 08:36:22 -05:00 committed by Samuel Ortiz
parent 3748f19355
commit 709edecd4e
1 changed files with 3 additions and 1 deletions

View File

@ -116,12 +116,14 @@ u32 __sta2x11_mfd_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val,
struct sta2x11_mfd *mfd = sta2x11_mfd_find(pdev);
u32 r;
unsigned long flags;
void __iomem *regs = mfd->regs[index];
void __iomem *regs;
if (!mfd) {
dev_warn(&pdev->dev, ": can't access sctl regs\n");
return 0;
}
regs = mfd->regs[index];
if (!regs) {
dev_warn(&pdev->dev, ": system ctl not initialized\n");
return 0;