forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/drivers/i2c/busses/i2c-xgene-slimpro.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * X-Gene SLIMpro I2C Driver
34 *
....@@ -5,22 +6,8 @@
56 * Author: Feng Kan <fkan@apm.com>
67 * Author: Hieu Le <hnle@apm.com>
78 *
8
- * This program is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU General Public License as
10
- * published by the Free Software Foundation; either version 2 of
11
- * the License, or (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
20
- *
219 * This driver provides support for X-Gene SLIMpro I2C device access
2210 * using the APM X-Gene SLIMpro mailbox driver.
23
- *
2411 */
2512 #include <acpi/pcc.h>
2613 #include <linux/acpi.h>
....@@ -321,6 +308,9 @@
321308 u32 msg[3];
322309 int rc;
323310
311
+ if (writelen > I2C_SMBUS_BLOCK_MAX)
312
+ return -EINVAL;
313
+
324314 memcpy(ctx->dma_buffer, data, writelen);
325315 paddr = dma_map_single(ctx->dev, ctx->dma_buffer, writelen,
326316 DMA_TO_DEVICE);