From: Wolfgang Grandegger <wg@grandegger.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Stephane Grosjean <s.grosjean@peak-system.com>,
linux-can Mailing List <linux-can@vger.kernel.org>
Subject: Re: can/sja1000: potential issue in sja1000.c?
Date: Fri, 10 Feb 2012 12:56:03 +0100 [thread overview]
Message-ID: <4F3505D3.3090701@grandegger.com> (raw)
In-Reply-To: <4F34FC8F.4000104@pengutronix.de>
On 02/10/2012 12:16 PM, Marc Kleine-Budde wrote:
> On 02/10/2012 12:00 PM, Stephane Grosjean wrote:
>> Hi all,
>>
>> While always fighting against pcmcia Oliver (very hot) unplug issue, I
>> decided to have a look to the sja1000 lib, since the pcmcia driver ISR
>> does call "sja1000_interrupt()",
>>
>> Unfortunately, I found that:
>>
>> if (isrc & IRQ_RI) {
>> /* receive interrupt */
>> while (status & SR_RBS) {
>> sja1000_rx(dev);
>> status = priv->read_reg(priv, REG_SR);
>> }
>> }
>>
>> My problem is, once the card is unplugged, every ioread in its
>> corresponding io space does return 0xff...
>> I just change this potential infinite while() into a corresponding
>> for(;;) loop to test, like this:
>>
>> - while (status & SR_RBS) {
>> + int i;
>> + for (i = 0; (status & SR_RBS) && (i < 10); i++) {
>>
>> And no more PC hang!
Good catch. The loop count should be limited to avoid hanging the system.
Wolfgang.
next prev parent reply other threads:[~2012-02-10 11:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-03 15:12 [PATCH v2] can/sja1000: add support for PEAK-System PCMCIA card Stephane Grosjean
2012-02-03 16:44 ` Oliver Hartkopp
2012-02-06 16:03 ` Oliver Hartkopp
2012-02-06 17:05 ` Sven Geggus
2012-02-06 17:41 ` Oliver Hartkopp
[not found] ` <4F30F691.5070307@peak-system.com>
2012-02-07 13:13 ` About can/usb v4 patches serie Oliver Hartkopp
2012-02-07 13:43 ` Stephane Grosjean
2012-02-07 13:51 ` Oliver Hartkopp
2012-02-15 14:41 ` Stephane Grosjean
2012-02-15 20:05 ` Oliver Hartkopp
2012-02-10 11:00 ` can/sja1000: potential issue in sja1000.c? Stephane Grosjean
2012-02-10 11:16 ` Marc Kleine-Budde
2012-02-10 11:44 ` Wolfgang Grandegger
2012-02-10 15:32 ` Sebastian Haas
2012-02-10 15:37 ` Marc Kleine-Budde
2012-02-10 11:56 ` Wolfgang Grandegger [this message]
2012-02-10 15:39 ` Oliver Hartkopp
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=4F3505D3.3090701@grandegger.com \
--to=wg@grandegger.com \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=s.grosjean@peak-system.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.