ide-cd: Don't warn on bogus block size unless it actually matters.
authorDavid S. Miller <davem@davemloft.net>
Tue, 23 Jun 2009 23:01:06 +0000 (16:01 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Jun 2009 07:32:30 +0000 (00:32 -0700)
Frans Pop reported that his CDROM drive reports a blocksize of 2352,
and this causes new warnings due to commit
e8e7b9eb11c34ee18bde8b7011af41938d1ad667 ("ide-cd: fix oops when using
growisofs").

What we're trying to do is make sure that "blocklen >> SECTOR_BITS"
is something the block layer won't choke on.

And for Frans' case "2352 >> SECTOR_BITS" is equal to
"2048 >> SECTOR_BITS", and thats "4".

So warning in this case gives no real benefit.

Reported-by: Frans Pop <elendil@planet.nl>
Tested-by: Frans Pop <elendil@planet.nl>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/ide/ide-cd.c

index 4a19686fcfe9a922ead806d98b62f07144f0c832..a9a1bfb14e7c7eac013dc515ac9550797ec0ee80 100644 (file)
@@ -876,9 +876,12 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
                return stat;
 
        /*
-        * Sanity check the given block size
+        * Sanity check the given block size, in so far as making
+        * sure the sectors_per_frame we give to the caller won't
+        * end up being bogus.
         */
        blocklen = be32_to_cpu(capbuf.blocklen);
+       blocklen = (blocklen >> SECTOR_BITS) << SECTOR_BITS;
        switch (blocklen) {
        case 512:
        case 1024: