* [PATCH 2/2] sh_eth: check TSU registers ioremap() error
@ 2013-03-19 23:41 Sergei Shtylyov
2013-03-20 16:23 ` David Miller
0 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2013-03-19 23:41 UTC (permalink / raw)
To: netdev; +Cc: nobuhiro.iwamatsu.yj
One must check the result of ioremap() -- in this case it prevents potential
kernel oops when initializing TSU registers further on...
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
drivers/net/ethernet/renesas/sh_eth.c | 5 +++++
1 file changed, 5 insertions(+)
Index: renesas/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- renesas.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ renesas/drivers/net/ethernet/renesas/sh_eth.c
@@ -2446,6 +2446,11 @@ static int sh_eth_drv_probe(struct platf
}
mdp->tsu_addr = ioremap(rtsu->start,
resource_size(rtsu));
+ if (mdp->tsu_addr == NULL) {
+ ret = -ENOMEM;
+ dev_err(&pdev->dev, "TSU ioremap failed.\n");
+ goto out_release;
+ }
mdp->port = devno % 2;
ndev->features = NETIF_F_HW_VLAN_FILTER;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] sh_eth: check TSU registers ioremap() error
2013-03-19 23:41 [PATCH 2/2] sh_eth: check TSU registers ioremap() error Sergei Shtylyov
@ 2013-03-20 16:23 ` David Miller
2013-03-20 19:04 ` Sergei Shtylyov
0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2013-03-20 16:23 UTC (permalink / raw)
To: sergei.shtylyov; +Cc: netdev, nobuhiro.iwamatsu.yj
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Wed, 20 Mar 2013 02:41:32 +0300
> One must check the result of ioremap() -- in this case it prevents potential
> kernel oops when initializing TSU registers further on...
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] sh_eth: check TSU registers ioremap() error
2013-03-20 19:16 ` Sergei Shtylyov
@ 2013-03-20 18:20 ` Denis Kirjanov
2013-03-20 19:45 ` Sergei Shtylyov
0 siblings, 1 reply; 6+ messages in thread
From: Denis Kirjanov @ 2013-03-20 18:20 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: David Miller, netdev, nobuhiro.iwamatsu.yj
It doesn't make sense to worry about branch misprediction during probe() :)
On 3/20/13, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
> On 03/20/2013 10:04 PM, Sergei Shtylyov wrote:
>
>>
>>>
>>>> One must check the result of ioremap() -- in this case it prevents
>>>> potential
>>>> kernel oops when initializing TSU registers further on...
>>>>
>>>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>>> Applied and queued up for -stable.
>>
>> Thanks. However, do you really think it's needed in stable? It's
>> only error path, after all...
>
> I forgot to add "unlikely" to the "error path". I usually don't mark
> such patches for stable, when I'm not in a hurry. :-)
>
> WBR, Sergei
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] sh_eth: check TSU registers ioremap() error
2013-03-20 16:23 ` David Miller
@ 2013-03-20 19:04 ` Sergei Shtylyov
2013-03-20 19:16 ` Sergei Shtylyov
0 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2013-03-20 19:04 UTC (permalink / raw)
To: David Miller; +Cc: netdev, nobuhiro.iwamatsu.yj
Hello.
On 03/20/2013 07:23 PM, David Miller wrote:
> From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Date: Wed, 20 Mar 2013 02:41:32 +0300
>
>> One must check the result of ioremap() -- in this case it prevents potential
>> kernel oops when initializing TSU registers further on...
>>
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Applied and queued up for -stable.
Thanks. However, do you really think it's needed in stable? It's
only error path, after all...
WBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] sh_eth: check TSU registers ioremap() error
2013-03-20 19:04 ` Sergei Shtylyov
@ 2013-03-20 19:16 ` Sergei Shtylyov
2013-03-20 18:20 ` Denis Kirjanov
0 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2013-03-20 19:16 UTC (permalink / raw)
To: David Miller; +Cc: netdev, nobuhiro.iwamatsu.yj
On 03/20/2013 10:04 PM, Sergei Shtylyov wrote:
>
>>
>>> One must check the result of ioremap() -- in this case it prevents
>>> potential
>>> kernel oops when initializing TSU registers further on...
>>>
>>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>> Applied and queued up for -stable.
>
> Thanks. However, do you really think it's needed in stable? It's
> only error path, after all...
I forgot to add "unlikely" to the "error path". I usually don't mark
such patches for stable, when I'm not in a hurry. :-)
WBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] sh_eth: check TSU registers ioremap() error
2013-03-20 18:20 ` Denis Kirjanov
@ 2013-03-20 19:45 ` Sergei Shtylyov
0 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2013-03-20 19:45 UTC (permalink / raw)
To: Denis Kirjanov; +Cc: David Miller, netdev, nobuhiro.iwamatsu.yj
Hello.
On 03/20/2013 09:20 PM, Denis Kirjanov wrote:
> It doesn't make sense to worry about branch misprediction during probe() :)
You misunderstood. I didn't mean using unlikely() at all, just that
the ioremap() failure is unlikely.
PS: Please, don't top post.
> On 3/20/13, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
>> On 03/20/2013 10:04 PM, Sergei Shtylyov wrote:
>>
>>>>> One must check the result of ioremap() -- in this case it prevents
>>>>> potential
>>>>> kernel oops when initializing TSU registers further on...
>>>>>
>>>>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>>>> Applied and queued up for -stable.
>>> Thanks. However, do you really think it's needed in stable? It's
>>> only error path, after all...
>> I forgot to add "unlikely" to the "error path". I usually don't mark
>> such patches for stable, when I'm not in a hurry. :-)
>>
WBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-03-20 18:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-19 23:41 [PATCH 2/2] sh_eth: check TSU registers ioremap() error Sergei Shtylyov
2013-03-20 16:23 ` David Miller
2013-03-20 19:04 ` Sergei Shtylyov
2013-03-20 19:16 ` Sergei Shtylyov
2013-03-20 18:20 ` Denis Kirjanov
2013-03-20 19:45 ` Sergei Shtylyov
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.