forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/iio/accel/mma9551_core.c
....@@ -1,15 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Common code for Freescale MMA955x Intelligent Sensor Platform drivers
34 * Copyright (c) 2014, Intel Corporation.
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms and conditions of the GNU General Public License,
7
- * version 2, as published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope it will be useful, but WITHOUT
10
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
- * more details.
135 */
146
157 #include <linux/module.h>
....@@ -304,9 +296,12 @@
304296
305297 ret = mma9551_transfer(client, app_id, MMA9551_CMD_READ_CONFIG,
306298 reg, NULL, 0, (u8 *)&v, 2);
299
+ if (ret < 0)
300
+ return ret;
301
+
307302 *val = be16_to_cpu(v);
308303
309
- return ret;
304
+ return 0;
310305 }
311306 EXPORT_SYMBOL(mma9551_read_config_word);
312307
....@@ -362,9 +357,12 @@
362357
363358 ret = mma9551_transfer(client, app_id, MMA9551_CMD_READ_STATUS,
364359 reg, NULL, 0, (u8 *)&v, 2);
360
+ if (ret < 0)
361
+ return ret;
362
+
365363 *val = be16_to_cpu(v);
366364
367
- return ret;
365
+ return 0;
368366 }
369367 EXPORT_SYMBOL(mma9551_read_status_word);
370368