Message ID | 20200220172403.26062-2-wsa+renesas@sang-engineering.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | i2c: of: reserve unknown and ancillary addresses | expand |
Hi Wolfram, On Thu, Feb 20, 2020 at 6:26 PM Wolfram Sang <wsa+renesas@sang-engineering.com> wrote: > We export this function, so we should check the paramter to make it parameter > NULL-compatible. > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> And then the check in i2c_acpi_find_client_by_adev() can be removed. BTW, can the i2c_verify_client() check in that function actually fail? If yes, it should call put_device(dev) on failure, like of_find_i2c_device_by_node() does. Gr{oetje,eeting}s, Geert
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; }
We export this function, so we should check the paramter to make it NULL-compatible. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- drivers/i2c/i2c-core-base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)