Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1291187

Re: [PATCH 11/19] clocksource: fix __ftm_clk_init result

Path csiph.com!goblin2!goblin.stu.neva.ru!aioe.org!bofh.it!news.nic.it!robomod
From Daniel Lezcano <daniel.lezcano@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH 11/19] clocksource: fix __ftm_clk_init result
Date Mon, 14 Dec 2015 14:30:03 +0100
Message-ID <qFBmr-6GS-29@gated-at.bofh.it> (permalink)
References <qcfnH-5il-3@gated-at.bofh.it> <qcfnJ-5il-49@gated-at.bofh.it> <qFyHU-4U5-35@gated-at.bofh.it>
X-Original-To Andrzej Hajda <a.hajda@samsung.com>, linux-kernel@vger.kernel.org
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=kNseE4mjpeKVZxjb9NoJ00IJ2Y8XAKsC4r63szotyJI=; b=Duw5Iz8u/r1FTwGfs3QtagwpPRSmqWf5+u5P4nYpV6iXm51TNozeoN1iKL8uqAL2qq GJHlrJ1SxW3o6pmtVhWptwryic+g6TsPFYmRidfhUszRhLiay3Hdq0/mKjffQogbbCci x9fqI1ERpyYH/xxLfSaQP2WR6dIp4jJNJi8gRhqSPVEV/1SR6numxjjqbQ2qjFPxZUdo AXfG72nyOQ0et8+nzH06YdPtXlrCLGVpu9KPF90XFeIEzL/LuPbYi5TpsGaVcOTeSecj dmDNE71TSqW5kecZ67ZOmjzHIlwFceHW+oXW0r8TBs1m0p8F8Bqkt/N4W5QTU+2JukLm HG0A==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=kNseE4mjpeKVZxjb9NoJ00IJ2Y8XAKsC4r63szotyJI=; b=CogzZ+FX6nkYi2G+Lz+iW5CHsD4uB/UDq1Nyx1wlHO2cTc83O+zqB1sQ49xOhc3a8G yr7lnuSMLT+oM2cJncdah7bJQU+kThFzi2ouJ3/kC0sPDTFhzjIO2egvUf6x6A5KCyDp ba7+HBuL03jlAOHCAu/qHOmPYpSo/DBpabIeLoNTcIkgrydLU2EhA3/cNIK+I+e0MEPg uFvZg7UeqGXF1o5aqHY7UPyIpyDHxMxFfK48wqYF0gzmsQjtwVIq08/vQpF1gi0jTJBa cjoNwTLITYHsvKmlTNOGWl9PM7v7dupydGs+l+TsUER7+XwZ9OCEuIFDPV74OIfXql2Z zV3Q==
X-Gm-Message-State ALoCoQlEPCEzz8+VmvLrKSIX4rmFCxJmN+K8tPfUGjZKHg30aFws2NpTMVhr2oaPqVs6yFpUS0zNftYqkltVxlzabkmvltpaqQ==
X-Received by 10.194.19.100 with SMTP id d4mr38197582wje.18.1450099664445; Mon, 14 Dec 2015 05:27:44 -0800 (PST)
User-Agent Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 92
Organization linux.* mail to news gateway
X-Original-Cc Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>, Marek Szyprowski <m.szyprowski@samsung.com>, Thomas Gleixner <tglx@linutronix.de>
X-Original-Date Mon, 14 Dec 2015 14:27:47 +0100
X-Original-Message-ID <566EC3D3.7030404@linaro.org>
X-Original-References <1443103227-25612-1-git-send-email-a.hajda@samsung.com> <1443103227-25612-12-git-send-email-a.hajda@samsung.com> <566E9B27.9010804@samsung.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1291187

Show key headers only | View raw


On 12/14/2015 11:34 AM, Andrzej Hajda wrote:
> Hi,
>
> Ping.

[ ... ]

Please as you fix this, also fix the caller.

freq = __ftm_clk_init(np, "ftm-evt-counter-en", "ftm-evt");
-if (freq <= 0)
+if (!freq)

and, by the way, isn't there an issue if in the DT "ftm-src" is declared 
before "ftm-evt" ?


> On 09/24/2015 04:00 PM, Andrzej Hajda wrote:
>> The function tries to return clock frequency (unsigned long) or error
>> (int < 0). Using int as a result could be dangerous. On the other side
>> caller is not interested in error value, so the best solution is to
>> return frequency or zero in case of error, for this unsigned long is OK.
>>
>> The problem has been detected using proposed semantic patch
>> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
>>
>> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
>>
>> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
>> ---
>> Hi,
>>
>> To avoid problems with too many mail recipients I have sent whole
>> patchset only to LKML. Anyway patches have no dependencies.
>>
>> Regards
>> Andrzej
>> ---
>>   drivers/clocksource/fsl_ftm_timer.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/clocksource/fsl_ftm_timer.c b/drivers/clocksource/fsl_ftm_timer.c
>> index ef43469..11a7ae7 100644
>> --- a/drivers/clocksource/fsl_ftm_timer.c
>> +++ b/drivers/clocksource/fsl_ftm_timer.c
>> @@ -248,7 +248,7 @@ static int __init ftm_clocksource_init(unsigned long freq)
>>   	return 0;
>>   }
>>
>> -static int __init __ftm_clk_init(struct device_node *np, char *cnt_name,
>> +static unsigned long __init __ftm_clk_init(struct device_node *np, char *cnt_name,
>>   				 char *ftm_name)
>>   {
>>   	struct clk *clk;
>> @@ -257,19 +257,19 @@ static int __init __ftm_clk_init(struct device_node *np, char *cnt_name,
>>   	clk = of_clk_get_by_name(np, cnt_name);
>>   	if (IS_ERR(clk)) {
>>   		pr_err("ftm: Cannot get \"%s\": %ld\n", cnt_name, PTR_ERR(clk));
>> -		return PTR_ERR(clk);
>> +		return 0;
>>   	}
>>   	err = clk_prepare_enable(clk);
>>   	if (err) {
>>   		pr_err("ftm: clock failed to prepare+enable \"%s\": %d\n",
>>   			cnt_name, err);
>> -		return err;
>> +		return 0;
>>   	}
>>
>>   	clk = of_clk_get_by_name(np, ftm_name);
>>   	if (IS_ERR(clk)) {
>>   		pr_err("ftm: Cannot get \"%s\": %ld\n", ftm_name, PTR_ERR(clk));
>> -		return PTR_ERR(clk);
>> +		return 0;
>>   	}
>>   	err = clk_prepare_enable(clk);
>>   	if (err)
>


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: [PATCH 11/19] clocksource: fix __ftm_clk_init result Andrzej Hajda <a.hajda@samsung.com> - 2015-12-14 11:40 +0100
  Re: [PATCH 11/19] clocksource: fix __ftm_clk_init result Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-12-14 14:30 +0100

csiph-web