hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/iio/accel/adxl345_i2c.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * ADXL345 3-Axis Digital Accelerometer I2C driver
34 *
45 * Copyright (c) 2017 Eva Rachel Retuya <eraretuya@gmail.com>
5
- *
6
- * This file is subject to the terms and conditions of version 2 of
7
- * the GNU General Public License. See the file COPYING in the main
8
- * directory of this archive for more details.
96 *
107 * 7-bit I2C slave address: 0x1D (ALT ADDRESS pin tied to VDDIO) or
118 * 0x53 (ALT ADDRESS pin grounded)
....@@ -27,6 +24,9 @@
2724 {
2825 struct regmap *regmap;
2926
27
+ if (!id)
28
+ return -ENODEV;
29
+
3030 regmap = devm_regmap_init_i2c(client, &adxl345_i2c_regmap_config);
3131 if (IS_ERR(regmap)) {
3232 dev_err(&client->dev, "Error initializing i2c regmap: %ld\n",
....@@ -35,7 +35,7 @@
3535 }
3636
3737 return adxl345_core_probe(&client->dev, regmap, id->driver_data,
38
- id ? id->name : NULL);
38
+ id->name);
3939 }
4040
4141 static int adxl345_i2c_remove(struct i2c_client *client)