diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2012-12-02 08:36:22 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-12-02 18:46:49 -0500 |
commit | 709edecd4eaaa210ea9296c6d8ec5e9cedf1abe3 (patch) | |
tree | b2f5323d5bd682ef8040db4e6d1642da5dc2767e /drivers | |
parent | 3748f193552ba21a8239c56eb616d946c47607e7 (diff) |
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')
-rw-r--r-- | drivers/mfd/sta2x11-mfd.c | 4 |
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, | |||
116 | struct sta2x11_mfd *mfd = sta2x11_mfd_find(pdev); | 116 | struct sta2x11_mfd *mfd = sta2x11_mfd_find(pdev); |
117 | u32 r; | 117 | u32 r; |
118 | unsigned long flags; | 118 | unsigned long flags; |
119 | void __iomem *regs = mfd->regs[index]; | 119 | void __iomem *regs; |
120 | 120 | ||
121 | if (!mfd) { | 121 | if (!mfd) { |
122 | dev_warn(&pdev->dev, ": can't access sctl regs\n"); | 122 | dev_warn(&pdev->dev, ": can't access sctl regs\n"); |
123 | return 0; | 123 | return 0; |
124 | } | 124 | } |
125 | |||
126 | regs = mfd->regs[index]; | ||
125 | if (!regs) { | 127 | if (!regs) { |
126 | dev_warn(&pdev->dev, ": system ctl not initialized\n"); | 128 | dev_warn(&pdev->dev, ": system ctl not initialized\n"); |
127 | return 0; | 129 | return 0; |