| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/drivers/video/mmp/common.c |
|---|
| 3 | 4 | * This driver is a common framework for Marvell Display Controller |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright (C) 2012 Marvell Technology Group Ltd. |
|---|
| 6 | 7 | * Authors: Zhou Zhu <zzhu3@marvell.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 9 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 10 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 11 | | - * option) any later version. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 14 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 15 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 16 | | - * more details. |
|---|
| 17 | | - * |
|---|
| 18 | | - * You should have received a copy of the GNU General Public License along with |
|---|
| 19 | | - * this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 20 | | - * |
|---|
| 21 | 8 | */ |
|---|
| 22 | 9 | |
|---|
| 23 | 10 | #include <linux/slab.h> |
|---|
| .. | .. |
|---|
| 166 | 153 | struct mmp_path *mmp_register_path(struct mmp_path_info *info) |
|---|
| 167 | 154 | { |
|---|
| 168 | 155 | int i; |
|---|
| 169 | | - size_t size; |
|---|
| 170 | 156 | struct mmp_path *path = NULL; |
|---|
| 171 | 157 | struct mmp_panel *panel; |
|---|
| 172 | 158 | |
|---|
| 173 | | - size = sizeof(struct mmp_path) |
|---|
| 174 | | - + sizeof(struct mmp_overlay) * info->overlay_num; |
|---|
| 175 | | - path = kzalloc(size, GFP_KERNEL); |
|---|
| 159 | + path = kzalloc(struct_size(path, overlays, info->overlay_num), |
|---|
| 160 | + GFP_KERNEL); |
|---|
| 176 | 161 | if (!path) |
|---|
| 177 | 162 | return NULL; |
|---|
| 178 | 163 | |
|---|