mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 05:39:54 -04:00
staging: kpc2000: kpc_i2c: fail probe if unable to get I/O resource
The kpc_i2c driver attempts to map its I/O space without verifying whether or not the result of platform_get_resource() is NULL. Make the driver check that platform_get_resource did not return NULL before attempting to use the value returned to map an I/O space. Signed-off-by: Geordan Neukum <gneukum1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
091971897e
commit
4ff740315a
1 changed files with 3 additions and 0 deletions
|
|
@ -587,6 +587,9 @@ static int pi2c_probe(struct platform_device *pldev)
|
|||
priv->adapter.algo = &smbus_algorithm;
|
||||
|
||||
res = platform_get_resource(pldev, IORESOURCE_MEM, 0);
|
||||
if (!res)
|
||||
return -ENXIO;
|
||||
|
||||
priv->smba = (unsigned long)ioremap_nocache(res->start, resource_size(res));
|
||||
|
||||
platform_set_drvdata(pldev, priv);
|
||||
|
|
|
|||
Loading…
Reference in a new issue