[PATCH v2] MTD: fix m25p80 64-bit divisions

David Woodhouse dwmw2 at infradead.org
Thu Dec 18 06:50:34 EST 2008


On Thu, 2008-12-18 at 13:09 +0200, Artem Bityutskiy wrote:
> 
> -       dev_info(&spi->dev, "%s (%d Kbytes)\n", info->name,
> -                       flash->mtd.size / 1024);
> +       dev_info(&spi->dev, "%s (%llu Kbytes)\n", info->name,
> +                       flash->mtd.size >> 10);

You can't assume that a uint64_t is unsigned long long. Sometimes it's
just a long. 

I don't think we have format specifiers for uint64_t; I think the best
way to do it is still to cast the argument to unsigned long long:

-       dev_info(&spi->dev, "%s (%d Kbytes)\n", info->name,
-                       flash->mtd.size / 1024);
+       dev_info(&spi->dev, "%s (%llu Kbytes)\n", info->name,
+                       (unsigned long long)flash->mtd.size >> 10);

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse at intel.com                              Intel Corporation




More information about the linux-mtd mailing list