Message ID | 1444986537-28387-2-git-send-email-anup.patel@broadcom.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Correct me if I remember it wrong, but I thought this patch has already been merged by Brian? Thanks, Ray On 10/16/2015 2:08 AM, Anup Patel wrote: > We should always type-cast pointer to "long" or "unsigned long" > because size of pointer is same as machine word size. This will > avoid pointer type-cast issues on both 32bit and 64bit systems. > > This patch fixes pointer type-cast issue in brcmnand_write() > as-per above info. > > Signed-off-by: Anup Patel <anup.patel@broadcom.com> > Reviewed-by: Vikram Prakash <vikramp@broadcom.com> > Reviewed-by: Ray Jui <rjui@broadcom.com> > Reviewed-by: Scott Branden <sbranden@broadcom.com> > --- > drivers/mtd/nand/brcmnand/brcmnand.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/mtd/nand/brcmnand/brcmnand.c b/drivers/mtd/nand/brcmnand/brcmnand.c > index fddb795..4cba03d 100644 > --- a/drivers/mtd/nand/brcmnand/brcmnand.c > +++ b/drivers/mtd/nand/brcmnand/brcmnand.c > @@ -1544,9 +1544,9 @@ static int brcmnand_write(struct mtd_info *mtd, struct nand_chip *chip, > > dev_dbg(ctrl->dev, "write %llx <- %p\n", (unsigned long long)addr, buf); > > - if (unlikely((u32)buf & 0x03)) { > + if (unlikely((unsigned long)buf & 0x03)) { > dev_warn(ctrl->dev, "unaligned buffer: %p\n", buf); > - buf = (u32 *)((u32)buf & ~0x03); > + buf = (u32 *)((unsigned long)buf & ~0x03); > } > > brcmnand_wp(mtd, 0); >
On Fri, Oct 16, 2015 at 08:36:22AM -0700, Ray Jui wrote: > Correct me if I remember it wrong, but I thought this patch has already > been merged by Brian? You are correct. Anup, Please base MTD patches on the MTD development tree (i.e., l2-mtd.git): http://linux-mtd.infradead.org/source.html (In this case it's no problem; I'll just ignore the first two patches.) Brian
> -----Original Message----- > From: Ray Jui [mailto:rjui@broadcom.com] > Sent: 16 October 2015 21:06 > To: Anup Patel; David Woodhouse; Brian Norris; linux-mtd@lists.infradead.org > Cc: Rob Herring; Pawel Moll; Mark Rutland; Ian Campbell; Kumar Gala; Catalin > Marinas; Will Deacon; Scott Branden; Florian Fainelli; Pramod Kumar; Vikram > Prakash; Sandeep Tripathy; linux-arm-kernel@lists.infradead.org; > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; bcm-kernel- > feedback-list > Subject: Re: [PATCH v2 1/4] mtd: brcmnand: Fix pointer type-cast in > brcmnand_write() > > Correct me if I remember it wrong, but I thought this patch has already been > merged by Brian? Yes, patch1 and patch2 were merged by Brian. I realized this after I had send-out v2. Anyways we can ignore patch1 and patch2 from this patchset because they are same as v1. Regards, Anup
diff --git a/drivers/mtd/nand/brcmnand/brcmnand.c b/drivers/mtd/nand/brcmnand/brcmnand.c index fddb795..4cba03d 100644 --- a/drivers/mtd/nand/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/brcmnand/brcmnand.c @@ -1544,9 +1544,9 @@ static int brcmnand_write(struct mtd_info *mtd, struct nand_chip *chip, dev_dbg(ctrl->dev, "write %llx <- %p\n", (unsigned long long)addr, buf); - if (unlikely((u32)buf & 0x03)) { + if (unlikely((unsigned long)buf & 0x03)) { dev_warn(ctrl->dev, "unaligned buffer: %p\n", buf); - buf = (u32 *)((u32)buf & ~0x03); + buf = (u32 *)((unsigned long)buf & ~0x03); } brcmnand_wp(mtd, 0);