Re: [PATCH] hpt366: fix section mismatch warnings

From: Sam Ravnborg
Date: Fri Feb 22 2008 - 15:43:26 EST


> @@ -1570,11 +1570,13 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic
> if (rev < 3)
> info = &hpt36x;
> else {
> - static const struct hpt_info *hpt37x_info[] =
> - { &hpt370, &hpt370a, &hpt372, &hpt372n };
> -
> - info = hpt37x_info[min_t(u8, rev, 6) - 3];
> - idx++;
> + switch (min_t(u8, rev, 6) - 3) {
> + case 0: info = &hpt370; break;
> + case 1: info = &hpt370a; break;
> + case 2: info = &hpt372; break;
> + case 3: info = &hpt372n; break;
> + }
> + idx++;
> }

I kept the calculation as it was before but the '- 3'
is not needed. So it could be fixed and the case N:
should then be updated.
[Thanks to Sergei to not this]

Another note: The warnings were seen with a
make CONFIG_DEBUG_SECTION_MISMATCH=y build so they most likely
does not show up duing a typical build due to the inlining performed
by gcc.

Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/