mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@misterjones.org>
To: Dominik Brodowski <linux@dominikbrodowski.net>,
	linux-kernel@vger.kernel.org
Subject: [BUG][PATCH][pcmcia] cisinfo_t removal prevents card detection
Date: Tue, 15 Jul 2008 15:26:15 +0200	[thread overview]
Message-ID: <487CA577.5090602@misterjones.org> (raw)

Dominik,

The commit

c5081d5f4775b2a3f858f91151bbf9163e473075 (pcmcia: simplify pccard_validate_cis)

that entered mainline yesterday introduced a bug that prevents card detection
on my platform (PXA255 based), and possibly others :

   @@ -1490,11 +1491,13 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_
               ((tuple->TupleCode > 0x90) && (tuple->TupleCode < 0xff)))
               reserved++;
        }
   -    if ((info->Chains == MAX_TUPLES) || (reserved > 5) ||
   -       ((!dev_ok || !ident_ok) && (info->Chains > 10)))
   -       info->Chains = 0;
   +    if ((count) || (reserved > 5) ||
   +       ((!dev_ok || !ident_ok) && (count > 10)))
   +       count = 0;

Since count starts at 1, condition is now always true, and count then
reset to 0. Restoring the comparaison to MAX_TUPLES makes everybody
happy...

	M.

Signed-off-by: Marc Zyngier <marc.zyngier@altran.com>

diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 9fcff0c..65129b5 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -1490,7 +1490,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned
  	    ((tuple->TupleCode > 0x90) && (tuple->TupleCode < 0xff)))
  	    reserved++;
      }
-    if ((count) || (reserved > 5) ||
+    if ((count == MAX_TUPLES) || (reserved > 5) ||
  	((!dev_ok || !ident_ok) && (count > 10)))
  	count = 0;

-- 
A rat a day keeps the plague away.

             reply	other threads:[~2008-07-15 13:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-15 13:26 Marc Zyngier [this message]
2008-07-15 13:36 ` Manuel Lauss

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=487CA577.5090602@misterjones.org \
    --to=maz@misterjones.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®