Commit 709edecd authored by Wei Yongjun's avatar Wei Yongjun Committed by Samuel Ortiz

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: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 3748f193
...@@ -116,12 +116,14 @@ u32 __sta2x11_mfd_mask(struct pci_dev *pdev, u32 reg, u32 mask, u32 val, ...@@ -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); struct sta2x11_mfd *mfd = sta2x11_mfd_find(pdev);
u32 r; u32 r;
unsigned long flags; unsigned long flags;
void __iomem *regs = mfd->regs[index]; void __iomem *regs;
if (!mfd) { if (!mfd) {
dev_warn(&pdev->dev, ": can't access sctl regs\n"); dev_warn(&pdev->dev, ": can't access sctl regs\n");
return 0; return 0;
} }
regs = mfd->regs[index];
if (!regs) { if (!regs) {
dev_warn(&pdev->dev, ": system ctl not initialized\n"); dev_warn(&pdev->dev, ": system ctl not initialized\n");
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment