staging: kpc2000: kpc_i2c: Use devm_* API to manage mapped I/O space

The kpc_i2c driver does not unmap its I/O space upon error cases in the
probe() function or upon remove(). Make the driver clean up after itself
more maintainably by using the managed resource API.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Geordan Neukum 2019-05-26 01:18:34 +00:00 committed by Greg Kroah-Hartman
parent e621c8a108
commit 299672a748

View File

@ -590,7 +590,9 @@ static int pi2c_probe(struct platform_device *pldev)
if (!res)
return -ENXIO;
priv->smba = (unsigned long)ioremap_nocache(res->start, resource_size(res));
priv->smba = (unsigned long)devm_ioremap_nocache(&pldev->dev,
res->start,
resource_size(res));
if (!priv->smba)
return -ENOMEM;