lkml.org 
[lkml]   [2019]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 7/8] staging: kpc2000: kpc_i2c: fail probe if unable to map I/O space
Date
The kpc2000 driver does not verify whether or not mapping the I/O
space succeeded during probe time. Make the driver verify that the
mapping operation was successful before potentially using that area
in the future.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
---
drivers/staging/kpc2000/kpc2000_i2c.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/staging/kpc2000/kpc2000_i2c.c b/drivers/staging/kpc2000/kpc2000_i2c.c
index 452052bf9476..51e91653e183 100644
--- a/drivers/staging/kpc2000/kpc2000_i2c.c
+++ b/drivers/staging/kpc2000/kpc2000_i2c.c
@@ -591,6 +591,8 @@ static int pi2c_probe(struct platform_device *pldev)
return -ENXIO;

priv->smba = (unsigned long)ioremap_nocache(res->start, resource_size(res));
+ if (!priv->smba)
+ return -ENOMEM;

platform_set_drvdata(pldev, priv);

--
2.21.0
\
 
 \ /
  Last update: 2019-05-26 03:20    [W:0.070 / U:0.508 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site