mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-28 05:14:41 -04:00
nvmem: rockchip-otp: alloc clks with main struct
Use a flexible array member to simplify allocation slightly. No need for a separate calloc. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Srinivas Kandagatla <srini@kernel.org> Link: https://patch.msgid.link/20260530205333.117458-3-srini@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1123dc1ae3
commit
9f99bb979f
@@ -78,9 +78,9 @@ struct rockchip_data {
|
||||
struct rockchip_otp {
|
||||
struct device *dev;
|
||||
void __iomem *base;
|
||||
struct clk_bulk_data *clks;
|
||||
struct reset_control *rst;
|
||||
const struct rockchip_data *data;
|
||||
struct clk_bulk_data clks[];
|
||||
};
|
||||
|
||||
static int rockchip_otp_reset(struct rockchip_otp *otp)
|
||||
@@ -424,7 +424,7 @@ static int rockchip_otp_probe(struct platform_device *pdev)
|
||||
if (!data)
|
||||
return dev_err_probe(dev, -EINVAL, "failed to get match data\n");
|
||||
|
||||
otp = devm_kzalloc(&pdev->dev, sizeof(struct rockchip_otp),
|
||||
otp = devm_kzalloc(&pdev->dev, struct_size(otp, clks, data->num_clks),
|
||||
GFP_KERNEL);
|
||||
if (!otp)
|
||||
return -ENOMEM;
|
||||
@@ -436,11 +436,6 @@ static int rockchip_otp_probe(struct platform_device *pdev)
|
||||
return dev_err_probe(dev, PTR_ERR(otp->base),
|
||||
"failed to ioremap resource\n");
|
||||
|
||||
otp->clks = devm_kcalloc(dev, data->num_clks, sizeof(*otp->clks),
|
||||
GFP_KERNEL);
|
||||
if (!otp->clks)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < data->num_clks; ++i)
|
||||
otp->clks[i].id = data->clks[i];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user