Skip to content

Commit 6eed8dd

Browse files
brglgregkh
authored andcommitted
nvmem: sunxi_sid: use devm_nvmem_register()
Use the resource managed variant of nvmem_register(). Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Srinivas Kandagatla <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 424d703 commit 6eed8dd

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

drivers/nvmem/sunxi_sid.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,13 @@ static int sunxi_sid_probe(struct platform_device *pdev)
181181
else
182182
econfig.reg_read = sunxi_sid_read;
183183
econfig.priv = sid;
184-
nvmem = nvmem_register(&econfig);
184+
nvmem = devm_nvmem_register(dev, &econfig);
185185
if (IS_ERR(nvmem))
186186
return PTR_ERR(nvmem);
187187

188188
randomness = kzalloc(size, GFP_KERNEL);
189-
if (!randomness) {
190-
ret = -ENOMEM;
191-
goto err_unreg_nvmem;
192-
}
189+
if (!randomness)
190+
return -ENOMEM;
193191

194192
for (i = 0; i < size; i++)
195193
econfig.reg_read(sid, i, &randomness[i], 1);
@@ -200,17 +198,6 @@ static int sunxi_sid_probe(struct platform_device *pdev)
200198
platform_set_drvdata(pdev, nvmem);
201199

202200
return 0;
203-
204-
err_unreg_nvmem:
205-
nvmem_unregister(nvmem);
206-
return ret;
207-
}
208-
209-
static int sunxi_sid_remove(struct platform_device *pdev)
210-
{
211-
struct nvmem_device *nvmem = platform_get_drvdata(pdev);
212-
213-
return nvmem_unregister(nvmem);
214201
}
215202

216203
static const struct sunxi_sid_cfg sun4i_a10_cfg = {
@@ -243,7 +230,6 @@ MODULE_DEVICE_TABLE(of, sunxi_sid_of_match);
243230

244231
static struct platform_driver sunxi_sid_driver = {
245232
.probe = sunxi_sid_probe,
246-
.remove = sunxi_sid_remove,
247233
.driver = {
248234
.name = "eeprom-sunxi-sid",
249235
.of_match_table = sunxi_sid_of_match,

0 commit comments

Comments
 (0)