[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200220172403.26062-2-wsa+renesas@sang-engineering.com>
Date: Thu, 20 Feb 2020 18:23:57 +0100
From: Wolfram Sang <wsa+renesas@...g-engineering.com>
To: linux-i2c@...r.kernel.org
Cc: linux-renesas-soc@...r.kernel.org, linux-i3c@...ts.infradead.org,
Kieran Bingham <kieran@...uared.org.uk>,
Niklas Söderlund <niklas.soderlund@...natech.se>,
Luca Ceresoli <luca@...aceresoli.net>,
Jacopo Mondi <jacopo@...ndi.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Vladimir Zapolskiy <vz@...ia.com>,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
Wolfram Sang <wsa+renesas@...g-engineering.com>
Subject: [RFC PATCH 1/7] i2c: add sanity check for parameter of i2c_verify_client()
We export this function, so we should check the paramter to make it
NULL-compatible.
Signed-off-by: Wolfram Sang <wsa+renesas@...g-engineering.com>
---
drivers/i2c/i2c-core-base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index cefad0881942..8f46d1bb8c62 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -517,7 +517,7 @@ EXPORT_SYMBOL_GPL(i2c_client_type);
*/
struct i2c_client *i2c_verify_client(struct device *dev)
{
- return (dev->type == &i2c_client_type)
+ return (dev && dev->type == &i2c_client_type)
? to_i2c_client(dev)
: NULL;
}
--
2.20.1
Powered by blists - more mailing lists