| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Amlogic Meson6, Meson8 and Meson8b eFuse Driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2017 Martin Blumenstingl <martin.blumenstingl@googlemail.com> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 7 | | - * under the terms of version 2 of the GNU General Public License as |
|---|
| 8 | | - * published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 11 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 12 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 13 | | - * more details. |
|---|
| 14 | 6 | */ |
|---|
| 15 | 7 | |
|---|
| 16 | 8 | #include <linux/bitfield.h> |
|---|
| .. | .. |
|---|
| 163 | 155 | if (err) |
|---|
| 164 | 156 | break; |
|---|
| 165 | 157 | |
|---|
| 166 | | - memcpy(buf + i, &tmp, efuse->config.word_size); |
|---|
| 158 | + memcpy(buf + i, &tmp, |
|---|
| 159 | + min_t(size_t, bytes - i, efuse->config.word_size)); |
|---|
| 167 | 160 | } |
|---|
| 168 | 161 | |
|---|
| 169 | 162 | meson_mx_efuse_mask_bits(efuse, MESON_MX_EFUSE_CNTL1, |
|---|