| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2016 Socionext Inc. |
|---|
| 3 | 4 | * Author: Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 7 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 8 | | - * (at your option) any later version. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | 5 | */ |
|---|
| 15 | 6 | |
|---|
| 16 | 7 | #include <linux/clk-provider.h> |
|---|
| .. | .. |
|---|
| 73 | 64 | for (p = data; p->name; p++) |
|---|
| 74 | 65 | clk_num = max(clk_num, p->idx + 1); |
|---|
| 75 | 66 | |
|---|
| 76 | | - hw_data = devm_kzalloc(dev, |
|---|
| 77 | | - sizeof(*hw_data) + clk_num * sizeof(struct clk_hw *), |
|---|
| 67 | + hw_data = devm_kzalloc(dev, struct_size(hw_data, hws, clk_num), |
|---|
| 78 | 68 | GFP_KERNEL); |
|---|
| 79 | 69 | if (!hw_data) |
|---|
| 80 | 70 | return -ENOMEM; |
|---|