mtd: pmc551: fix signedness bug in init_pmc551()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Mar 26 20:59:02 EDT 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=2ff5e1532dd37e1bd8ac72da3f7f0e2b310102fb
Commit:     2ff5e1532dd37e1bd8ac72da3f7f0e2b310102fb
Parent:     30ec5a2cb17d78482de0cf9e38721410d48c086d
Author:     Xi Wang <xi.wang at gmail.com>
AuthorDate: Mon Jan 9 16:58:25 2012 -0500
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Tue Mar 27 00:11:07 2012 +0100

    mtd: pmc551: fix signedness bug in init_pmc551()
    
    Since "length" is a u32, the error handling below didn't work when
    fixup_pmc551() returns -ENODEV.
    
    	if ((length = fixup_pmc551(PCI_Device)) <= 0)
    
    This patch changes both the type of "length" and the return type of
    fixup_pmc551() to int.
    
    Signed-off-by: Xi Wang <xi.wang at gmail.com>
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/devices/pmc551.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c
index ecff765..cfccf65 100644
--- a/drivers/mtd/devices/pmc551.c
+++ b/drivers/mtd/devices/pmc551.c
@@ -359,7 +359,7 @@ static int pmc551_write(struct mtd_info *mtd, loff_t to, size_t len,
  * mechanism
  * returns the size of the memory region found.
  */
-static u32 fixup_pmc551(struct pci_dev *dev)
+static int fixup_pmc551(struct pci_dev *dev)
 {
 #ifdef CONFIG_MTD_PMC551_BUGFIX
 	u32 dram_data;
@@ -669,7 +669,7 @@ static int __init init_pmc551(void)
 	struct mypriv *priv;
 	int found = 0;
 	struct mtd_info *mtd;
-	u32 length = 0;
+	int length = 0;
 
 	if (msize) {
 		msize = (1 << (ffs(msize) - 1)) << 20;



More information about the linux-mtd-cvs mailing list