| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ADXL345 3-Axis Digital Accelerometer I2C driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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. |
|---|
| 9 | 6 | * |
|---|
| 10 | 7 | * 7-bit I2C slave address: 0x1D (ALT ADDRESS pin tied to VDDIO) or |
|---|
| 11 | 8 | * 0x53 (ALT ADDRESS pin grounded) |
|---|
| .. | .. |
|---|
| 27 | 24 | { |
|---|
| 28 | 25 | struct regmap *regmap; |
|---|
| 29 | 26 | |
|---|
| 27 | + if (!id) |
|---|
| 28 | + return -ENODEV; |
|---|
| 29 | + |
|---|
| 30 | 30 | regmap = devm_regmap_init_i2c(client, &adxl345_i2c_regmap_config); |
|---|
| 31 | 31 | if (IS_ERR(regmap)) { |
|---|
| 32 | 32 | dev_err(&client->dev, "Error initializing i2c regmap: %ld\n", |
|---|
| .. | .. |
|---|
| 35 | 35 | } |
|---|
| 36 | 36 | |
|---|
| 37 | 37 | return adxl345_core_probe(&client->dev, regmap, id->driver_data, |
|---|
| 38 | | - id ? id->name : NULL); |
|---|
| 38 | + id->name); |
|---|
| 39 | 39 | } |
|---|
| 40 | 40 | |
|---|
| 41 | 41 | static int adxl345_i2c_remove(struct i2c_client *client) |
|---|