All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Xu YiPing <xuyiping@hisilicon.com>
Cc: mturquette@baylibre.com, robh+dt@kernel.org,
	mark.rutland@arm.com, xuwei5@hisilicon.com,
	catalin.marinas@arm.com, will.deacon@arm.com,
	xuejiancheng@hisilicon.com, wenpan@hisilicon.com,
	leo.yan@linaro.org, zhangfei.gao@linaro.org,
	guodong.xu@linaro.org, zhongkaihua@huawei.com,
	chenjun14@huawei.com, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, suzhuangluan@hisilicon.com,
	xuezhiliang@hisilicon.com, kevin.wangtao@hisilicon.com
Subject: Re: [PATCH v3 2/3] clk: hisilicon: Add support for Hi3660 stub clocks
Date: Wed, 6 Dec 2017 23:05:50 -0800	[thread overview]
Message-ID: <20171207070550.GY4283@codeaurora.org> (raw)
In-Reply-To: <1510910852-2175-3-git-send-email-xuyiping@hisilicon.com>

On 11/17, Xu YiPing wrote:
> From: Kaihua Zhong <zhongkaihua@huawei.com>
> +
> +static struct clk_hw *hi3660_stub_clk_hw_get(struct of_phandle_args *clkspec,
> +					     void *data)
> +{
> +	unsigned int idx = clkspec->args[0];
> +
> +	if (idx > HI3660_CLK_STUB_NUM) {

This should be >=

> +	}
> +
> +	return &hi3660_stub_clks[idx].hw;
> +}
> +
> +static int hi3660_stub_clk_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct resource *res;
> +	unsigned int i;
> +	int ret;
> +
> +	/* Use mailbox client without blocking */
> +	stub_clk_chan.cl.dev = dev;
> +	stub_clk_chan.cl.tx_done = NULL;
> +	stub_clk_chan.cl.tx_block = false;
> +	stub_clk_chan.cl.knows_txdone = false;
> +
> +	/* Allocate mailbox channel */
> +	stub_clk_chan.mbox = mbox_request_channel(&stub_clk_chan.cl, 0);
> +	if (IS_ERR(stub_clk_chan.mbox))
> +		return PTR_ERR(stub_clk_chan.mbox);
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	freq_reg = devm_ioremap(dev, res->start, resource_size(res));
> +	if (IS_ERR(freq_reg))

Pretty sure this returns NULL on failure, not an error pointer.

> +		return -ENOMEM;
> +
> +	freq_reg += HI3660_STUB_CLOCK_DATA;
> +
> +	for (i = 0; i < HI3660_CLK_STUB_NUM; i++) {
> +		ret = devm_clk_hw_register(&pdev->dev, &hi3660_stub_clks[i].hw);
> +		if (ret)
> +			return ret;
> +	}
> +
> +	ret = of_clk_add_hw_provider(pdev->dev.of_node, hi3660_stub_clk_hw_get,
> +				     hi3660_stub_clks);

This can use devm

> +	return ret;
> +}
> +

I fixed it all and merged into clk-next.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

WARNING: multiple messages have this Message-ID (diff)
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 2/3] clk: hisilicon: Add support for Hi3660 stub clocks
Date: Wed, 6 Dec 2017 23:05:50 -0800	[thread overview]
Message-ID: <20171207070550.GY4283@codeaurora.org> (raw)
In-Reply-To: <1510910852-2175-3-git-send-email-xuyiping@hisilicon.com>

On 11/17, Xu YiPing wrote:
> From: Kaihua Zhong <zhongkaihua@huawei.com>
> +
> +static struct clk_hw *hi3660_stub_clk_hw_get(struct of_phandle_args *clkspec,
> +					     void *data)
> +{
> +	unsigned int idx = clkspec->args[0];
> +
> +	if (idx > HI3660_CLK_STUB_NUM) {

This should be >=

> +	}
> +
> +	return &hi3660_stub_clks[idx].hw;
> +}
> +
> +static int hi3660_stub_clk_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct resource *res;
> +	unsigned int i;
> +	int ret;
> +
> +	/* Use mailbox client without blocking */
> +	stub_clk_chan.cl.dev = dev;
> +	stub_clk_chan.cl.tx_done = NULL;
> +	stub_clk_chan.cl.tx_block = false;
> +	stub_clk_chan.cl.knows_txdone = false;
> +
> +	/* Allocate mailbox channel */
> +	stub_clk_chan.mbox = mbox_request_channel(&stub_clk_chan.cl, 0);
> +	if (IS_ERR(stub_clk_chan.mbox))
> +		return PTR_ERR(stub_clk_chan.mbox);
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	freq_reg = devm_ioremap(dev, res->start, resource_size(res));
> +	if (IS_ERR(freq_reg))

Pretty sure this returns NULL on failure, not an error pointer.

> +		return -ENOMEM;
> +
> +	freq_reg += HI3660_STUB_CLOCK_DATA;
> +
> +	for (i = 0; i < HI3660_CLK_STUB_NUM; i++) {
> +		ret = devm_clk_hw_register(&pdev->dev, &hi3660_stub_clks[i].hw);
> +		if (ret)
> +			return ret;
> +	}
> +
> +	ret = of_clk_add_hw_provider(pdev->dev.of_node, hi3660_stub_clk_hw_get,
> +				     hi3660_stub_clks);

This can use devm

> +	return ret;
> +}
> +

I fixed it all and merged into clk-next.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  parent reply	other threads:[~2017-12-07  7:05 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-17  9:27 [PATCH v3 0/3] Add support for Hi3660 stub clock Xu YiPing
2017-11-17  9:27 ` Xu YiPing
2017-11-17  9:27 ` Xu YiPing
2017-11-17  9:27 ` [PATCH v3 1/3] dt-bindings: clk: Hi3660: Document " Xu YiPing
2017-11-17  9:27   ` Xu YiPing
2017-11-17  9:27   ` Xu YiPing
2017-12-07  7:00   ` Stephen Boyd
2017-12-07  7:00     ` Stephen Boyd
2017-11-17  9:27 ` [PATCH v3 2/3] clk: hisilicon: Add support for Hi3660 stub clocks Xu YiPing
2017-11-17  9:27   ` Xu YiPing
2017-11-17  9:27   ` Xu YiPing
2017-12-05  2:33   ` Leo Yan
2017-12-05  2:33     ` Leo Yan
2017-12-07  7:05   ` Stephen Boyd [this message]
2017-12-07  7:05     ` Stephen Boyd
2017-12-07  8:04     ` Leo Yan
2017-12-07  8:04       ` Leo Yan
2017-11-17  9:27 ` [PATCH v3 3/3] arm64: dts: Hi3660: Add binding for stub clock Xu YiPing
2017-11-17  9:27   ` Xu YiPing
2017-11-17  9:27   ` Xu YiPing
2018-02-28  5:06   ` Leo Yan
2018-02-28  5:06     ` Leo Yan
2018-03-02 15:54     ` Wei Xu
2018-03-02 15:54       ` Wei Xu
2018-03-02 15:54       ` Wei Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171207070550.GY4283@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=catalin.marinas@arm.com \
    --cc=chenjun14@huawei.com \
    --cc=devicetree@vger.kernel.org \
    --cc=guodong.xu@linaro.org \
    --cc=kevin.wangtao@hisilicon.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=suzhuangluan@hisilicon.com \
    --cc=wenpan@hisilicon.com \
    --cc=will.deacon@arm.com \
    --cc=xuejiancheng@hisilicon.com \
    --cc=xuezhiliang@hisilicon.com \
    --cc=xuwei5@hisilicon.com \
    --cc=xuyiping@hisilicon.com \
    --cc=zhangfei.gao@linaro.org \
    --cc=zhongkaihua@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.