aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/pm8921-core.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/mfd/pm8921-core.c b/drivers/mfd/pm8921-core.c
index 9a7c991a3826..a6841f77aa5e 100644
--- a/drivers/mfd/pm8921-core.c
+++ b/drivers/mfd/pm8921-core.c
@@ -118,7 +118,7 @@ static int pm8921_probe(struct platform_device *pdev)
118 return -EINVAL; 118 return -EINVAL;
119 } 119 }
120 120
121 pmic = kzalloc(sizeof(struct pm8921), GFP_KERNEL); 121 pmic = devm_kzalloc(&pdev->dev, sizeof(struct pm8921), GFP_KERNEL);
122 if (!pmic) { 122 if (!pmic) {
123 pr_err("Cannot alloc pm8921 struct\n"); 123 pr_err("Cannot alloc pm8921 struct\n");
124 return -ENOMEM; 124 return -ENOMEM;
@@ -128,7 +128,7 @@ static int pm8921_probe(struct platform_device *pdev)
128 rc = ssbi_read(pdev->dev.parent, REG_HWREV, &val, sizeof(val)); 128 rc = ssbi_read(pdev->dev.parent, REG_HWREV, &val, sizeof(val));
129 if (rc) { 129 if (rc) {
130 pr_err("Failed to read hw rev reg %d:rc=%d\n", REG_HWREV, rc); 130 pr_err("Failed to read hw rev reg %d:rc=%d\n", REG_HWREV, rc);
131 goto err_read_rev; 131 return rc;
132 } 132 }
133 pr_info("PMIC revision 1: %02X\n", val); 133 pr_info("PMIC revision 1: %02X\n", val);
134 rev = val; 134 rev = val;
@@ -138,7 +138,7 @@ static int pm8921_probe(struct platform_device *pdev)
138 if (rc) { 138 if (rc) {
139 pr_err("Failed to read hw rev 2 reg %d:rc=%d\n", 139 pr_err("Failed to read hw rev 2 reg %d:rc=%d\n",
140 REG_HWREV_2, rc); 140 REG_HWREV_2, rc);
141 goto err_read_rev; 141 return rc;
142 } 142 }
143 pr_info("PMIC revision 2: %02X\n", val); 143 pr_info("PMIC revision 2: %02X\n", val);
144 rev |= val << BITS_PER_BYTE; 144 rev |= val << BITS_PER_BYTE;
@@ -160,8 +160,6 @@ static int pm8921_probe(struct platform_device *pdev)
160 160
161err: 161err:
162 mfd_remove_devices(pmic->dev); 162 mfd_remove_devices(pmic->dev);
163err_read_rev:
164 kfree(pmic);
165 return rc; 163 return rc;
166} 164}
167 165
@@ -179,7 +177,6 @@ static int pm8921_remove(struct platform_device *pdev)
179 pm8xxx_irq_exit(pmic->irq_chip); 177 pm8xxx_irq_exit(pmic->irq_chip);
180 pmic->irq_chip = NULL; 178 pmic->irq_chip = NULL;
181 } 179 }
182 kfree(pmic);
183 180
184 return 0; 181 return 0;
185} 182}