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


Groups > linux.kernel > #1579620 > unrolled thread

[patch net-next] net: qcom/emac: fix a sizeof() typo

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2017-02-13 12:10 +0100
Last post2017-02-14 04:30 +0100
Articles 8 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [patch net-next] net: qcom/emac: fix a sizeof() typo Dan Carpenter <dan.carpenter@oracle.com> - 2017-02-13 12:10 +0100
    Re: [patch net-next] net: qcom/emac: fix a sizeof() typo walter harms <wharms@bfs.de> - 2017-02-13 13:00 +0100
      Re: [patch net-next] net: qcom/emac: fix a sizeof() typo Timur Tabi <timur@codeaurora.org> - 2017-02-13 14:10 +0100
        Re: [patch net-next] net: qcom/emac: fix a sizeof() typo walter harms <wharms@bfs.de> - 2017-02-13 14:30 +0100
          Re: [patch net-next] net: qcom/emac: fix a sizeof() typo Timur Tabi <timur@codeaurora.org> - 2017-02-13 16:50 +0100
      Re: [patch net-next] net: qcom/emac: fix a sizeof() typo Dan Carpenter <dan.carpenter@oracle.com> - 2017-02-13 15:10 +0100
    Re: [patch net-next] net: qcom/emac: fix a sizeof() typo Timur Tabi <timur@codeaurora.org> - 2017-02-13 16:50 +0100
    Re: [patch net-next] net: qcom/emac: fix a sizeof() typo David Miller <davem@davemloft.net> - 2017-02-14 04:30 +0100

#1579620 — [patch net-next] net: qcom/emac: fix a sizeof() typo

FromDan Carpenter <dan.carpenter@oracle.com>
Date2017-02-13 12:10 +0100
Subject[patch net-next] net: qcom/emac: fix a sizeof() typo
Message-ID<tamG5-2UT-1@gated-at.bofh.it>
We had intended to say "sizeof(u32)" but the "u" is missing.
Fortunately, sizeof(32) is also 4, so the original code still works.

Fixes: c4e7beea2192 ("net: qcom/emac: add ethtool support for reading hardware registers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/ethernet/qualcomm/emac/emac-ethtool.c b/drivers/net/ethernet/qualcomm/emac/emac-ethtool.c
index 0d9945fb79be..bbe24639aa5a 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac-ethtool.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac-ethtool.c
@@ -227,7 +227,7 @@ static void emac_get_regs(struct net_device *netdev,
 
 static int emac_get_regs_len(struct net_device *netdev)
 {
-	return EMAC_MAX_REG_SIZE * sizeof(32);
+	return EMAC_MAX_REG_SIZE * sizeof(u32);
 }
 
 static const struct ethtool_ops emac_ethtool_ops = {

[toc] | [next] | [standalone]


#1579661

Fromwalter harms <wharms@bfs.de>
Date2017-02-13 13:00 +0100
Message-ID<tansu-3dO-21@gated-at.bofh.it>
In reply to#1579620

Am 13.02.2017 12:00, schrieb Dan Carpenter:
> We had intended to say "sizeof(u32)" but the "u" is missing.
> Fortunately, sizeof(32) is also 4, so the original code still works.
> 
> Fixes: c4e7beea2192 ("net: qcom/emac: add ethtool support for reading hardware registers")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/net/ethernet/qualcomm/emac/emac-ethtool.c b/drivers/net/ethernet/qualcomm/emac/emac-ethtool.c
> index 0d9945fb79be..bbe24639aa5a 100644
> --- a/drivers/net/ethernet/qualcomm/emac/emac-ethtool.c
> +++ b/drivers/net/ethernet/qualcomm/emac/emac-ethtool.c
> @@ -227,7 +227,7 @@ static void emac_get_regs(struct net_device *netdev,
>  
>  static int emac_get_regs_len(struct net_device *netdev)
>  {
> -	return EMAC_MAX_REG_SIZE * sizeof(32);
> +	return EMAC_MAX_REG_SIZE * sizeof(u32);
>  }
>  


We have a function where the argument is ignored and the rest is const ?

emac_ethtool_get_regs_len seems the only user. So it would be fairly easy to
move that into that function.

@maintainer:
Is there a deeper logic behind this ?


re,
 wh



>  static const struct ethtool_ops emac_ethtool_ops = {
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[toc] | [prev] | [next] | [standalone]


#1579695

FromTimur Tabi <timur@codeaurora.org>
Date2017-02-13 14:10 +0100
Message-ID<taoye-47y-17@gated-at.bofh.it>
In reply to#1579661
walter harms wrote:
> We have a function where the argument is ignored and the rest is const ?
>
> emac_ethtool_get_regs_len seems the only user. So it would be fairly easy to
> move that into that function.
>
> @maintainer:
> Is there a deeper logic behind this ?

I don't understand the question.

The patch is valid (I have no idea how I made that mistake).

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.

[toc] | [prev] | [next] | [standalone]


#1579778

Fromwalter harms <wharms@bfs.de>
Date2017-02-13 14:30 +0100
Message-ID<taoRB-4fA-45@gated-at.bofh.it>
In reply to#1579695

Am 13.02.2017 14:03, schrieb Timur Tabi:
> walter harms wrote:
>> We have a function where the argument is ignored and the rest is const ?
>>
>> emac_ethtool_get_regs_len seems the only user. So it would be fairly
>> easy to
>> move that into that function.
>>
>> @maintainer:
>> Is there a deeper logic behind this ?
> 
> I don't understand the question.


The question is: why is a simple calculation const*const
separated into a function ?

re,
 wh

[toc] | [prev] | [next] | [standalone]


#1579888

FromTimur Tabi <timur@codeaurora.org>
Date2017-02-13 16:50 +0100
Message-ID<tar34-5BW-5@gated-at.bofh.it>
In reply to#1579778
walter harms wrote:
> The question is: why is a simple calculation const*const
> separated into a function ?

This is a callback function.  That's just how it's defined.

It's rare, but there are drivers that use the parameter, like this one:

http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/tree/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c#n591

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.

[toc] | [prev] | [next] | [standalone]


#1579805

FromDan Carpenter <dan.carpenter@oracle.com>
Date2017-02-13 15:10 +0100
Message-ID<tapuj-4IS-37@gated-at.bofh.it>
In reply to#1579661
On Mon, Feb 13, 2017 at 12:55:03PM +0100, walter harms wrote:
> 
> 
> Am 13.02.2017 12:00, schrieb Dan Carpenter:
> > We had intended to say "sizeof(u32)" but the "u" is missing.
> > Fortunately, sizeof(32) is also 4, so the original code still works.
> > 
> > Fixes: c4e7beea2192 ("net: qcom/emac: add ethtool support for reading hardware registers")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/drivers/net/ethernet/qualcomm/emac/emac-ethtool.c b/drivers/net/ethernet/qualcomm/emac/emac-ethtool.c
> > index 0d9945fb79be..bbe24639aa5a 100644
> > --- a/drivers/net/ethernet/qualcomm/emac/emac-ethtool.c
> > +++ b/drivers/net/ethernet/qualcomm/emac/emac-ethtool.c
> > @@ -227,7 +227,7 @@ static void emac_get_regs(struct net_device *netdev,
> >  
> >  static int emac_get_regs_len(struct net_device *netdev)
> >  {
> > -	return EMAC_MAX_REG_SIZE * sizeof(32);
> > +	return EMAC_MAX_REG_SIZE * sizeof(u32);
> >  }
> >  
> 
> 
> We have a function where the argument is ignored and the rest is const ?
> 
> emac_ethtool_get_regs_len seems the only user. So it would be fairly easy to
> move that into that function.

It's not the only user.  We have to pass netdev because it's used as a
function pointer.

regards,
dan carpenter

[toc] | [prev] | [next] | [standalone]


#1579886

FromTimur Tabi <timur@codeaurora.org>
Date2017-02-13 16:50 +0100
Message-ID<tar33-5BW-3@gated-at.bofh.it>
In reply to#1579620
Dan Carpenter wrote:
> We had intended to say "sizeof(u32)" but the "u" is missing.
> Fortunately, sizeof(32) is also 4, so the original code still works.
>
> Fixes: c4e7beea2192 ("net: qcom/emac: add ethtool support for reading hardware registers")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Timur Tabi <timur@codeaurora.org>

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.

[toc] | [prev] | [next] | [standalone]


#1580251

FromDavid Miller <davem@davemloft.net>
Date2017-02-14 04:30 +0100
Message-ID<taBYt-4zm-3@gated-at.bofh.it>
In reply to#1579620
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Mon, 13 Feb 2017 14:00:22 +0300

> We had intended to say "sizeof(u32)" but the "u" is missing.
> Fortunately, sizeof(32) is also 4, so the original code still works.
> 
> Fixes: c4e7beea2192 ("net: qcom/emac: add ethtool support for reading hardware registers")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web