aboutsummaryrefslogtreecommitdiff
path: root/drivers/mfd/sta2x11-mfd.c
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2012-12-02 08:36:22 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2012-12-03 00:46:49 +0100
commit709edecd4eaaa210ea9296c6d8ec5e9cedf1abe3 (patch)
treeb2f5323d5bd682ef8040db4e6d1642da5dc2767e /drivers/mfd/sta2x11-mfd.c
parent3748f193552ba21a8239c56eb616d946c47607e7 (diff)
downloadlinux-linaro-stable-709edecd4eaaa210ea9296c6d8ec5e9cedf1abe3.tar.gz
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>
Diffstat (limited to 'drivers/mfd/sta2x11-mfd.c')
-rw-r--r--drivers/mfd/sta2x11-mfd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mfd/sta2x11-mfd.c b/drivers/mfd/sta2x11-mfd.c
index 6fb0938a9665..009b4b7721eb 100644
--- a/drivers/mfd/sta2x11-mfd.c
+++ b/drivers/mfd/sta2x11-mfd.c
@@ -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;