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


Groups > linux.kernel > #1370293

Re: [PATCH 2/6] net: ethernet: renesas: ravb_main: test clock rate to avoid division by 0

From Wolfram Sang <wsa@the-dreams.de>
Newsgroups linux.kernel
Subject Re: [PATCH 2/6] net: ethernet: renesas: ravb_main: test clock rate to avoid division by 0
Date 2016-04-03 23:40 +0200
Message-ID <rjXUt-15s-3@gated-at.bofh.it> (permalink)
References <r8nAZ-682-5@gated-at.bofh.it> <r8nB0-682-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, Mar 02, 2016 at 11:33:33PM +0100, Wolfram Sang wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> The clk API may return 0 on clk_get_rate, so we should check the result before
> using it as a divisor.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Ping.

> ---
> 
> Should go individually via subsystem tree.
> 
>  drivers/net/ethernet/renesas/ravb_main.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 88656ceb6e2946..ce1954a6a12726 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -1691,6 +1691,9 @@ static int ravb_set_gti(struct net_device *ndev)
>  	rate = clk_get_rate(clk);
>  	clk_put(clk);
>  
> +	if (!rate)
> +		return -EINVAL;
> +
>  	inc = 1000000000ULL << 20;
>  	do_div(inc, rate);
>  
> -- 
> 2.7.0
> 
> 

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


Thread

Re: [PATCH 2/6] net: ethernet: renesas: ravb_main: test clock rate  to avoid division by 0 Wolfram Sang <wsa@the-dreams.de> - 2016-04-03 23:40 +0200
  Re: [PATCH 2/6] net: ethernet: renesas: ravb_main: test clock rate to  avoid division by 0 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-04-04 00:30 +0200

csiph-web