linux-stable/drivers/clk/uniphier/clk-uniphier-fixed-rate.c
Kunihiko Hayashi ca85a66710 clk: uniphier: Fix fixed-rate initialization
Fixed-rate clocks in UniPhier don't have any parent clocks, however,
initial data "init.flags" isn't initialized, so it might be determined
that there is a parent clock for fixed-rate clock.

This sets init.flags to zero as initialization.

Cc: <stable@vger.kernel.org>
Fixes: 734d82f4a6 ("clk: uniphier: add core support code for UniPhier clock driver")
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Link: https://lore.kernel.org/r/1646808918-30899-1-git-send-email-hayashi.kunihiko@socionext.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
2022-03-11 19:29:02 -08:00

39 lines
871 B
C

// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2016 Socionext Inc.
* Author: Masahiro Yamada <yamada.masahiro@socionext.com>
*/
#include <linux/clk-provider.h>
#include <linux/device.h>
#include "clk-uniphier.h"
struct clk_hw *uniphier_clk_register_fixed_rate(struct device *dev,
const char *name,
const struct uniphier_clk_fixed_rate_data *data)
{
struct clk_fixed_rate *fixed;
struct clk_init_data init;
int ret;
/* allocate fixed-rate clock */
fixed = devm_kzalloc(dev, sizeof(*fixed), GFP_KERNEL);
if (!fixed)
return ERR_PTR(-ENOMEM);
init.name = name;
init.ops = &clk_fixed_rate_ops;
init.flags = 0;
init.parent_names = NULL;
init.num_parents = 0;
fixed->fixed_rate = data->fixed_rate;
fixed->hw.init = &init;
ret = devm_clk_hw_register(dev, &fixed->hw);
if (ret)
return ERR_PTR(ret);
return &fixed->hw;
}