From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org,
Stephen Rothwell <sfr@canb.auug.org.au>,
Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Subject: [PATCH] mtd: mtdram: fix build error
Date: Wed, 30 Sep 2015 14:05:58 +0530 [thread overview]
Message-ID: <1443602158-631-1-git-send-email-sudipm.mukherjee@gmail.com> (raw)
i386 allmodconfig fails with:
ERROR: "__umoddi3" [drivers/mtd/devices/mtdram.ko] undefined!
ERROR: "__moddi3" [drivers/mtd/devices/mtdram.ko] undefined!
arm allmodconfig fails with:
ERROR: "__aeabi_uldivmod" [drivers/mtd/devices/mtdram.ko] undefined!
ERROR: "__aeabi_ldivmod" [drivers/mtd/devices/mtdram.ko] undefined!
The modulus operation is not being supported by these compilers. Use
do_div() instead which returns the remainder.
Fixes: 7827e3acad2d ("mtd: mtdram: check offs and len in mtdram->erase")
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
drivers/mtd/devices/mtdram.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c
index 73fa297..d085167 100644
--- a/drivers/mtd/devices/mtdram.c
+++ b/drivers/mtd/devices/mtdram.c
@@ -35,15 +35,21 @@ static struct mtd_info *mtd_info;
static int check_offs_len(struct mtd_info *mtd, loff_t ofs, uint64_t len)
{
int ret = 0;
+ unsigned long temp_len, rem;
/* Start address must align on block boundary */
- if (ofs % mtd->erasesize) {
+ temp_len = ofs;
+ rem = do_div(temp_len, mtd->erasesize);
+ if (rem) {
pr_debug("%s: unaligned address\n", __func__);
ret = -EINVAL;
}
/* Length must align on block boundary */
- if (len % mtd->erasesize) {
+ temp_len = len;
+ rem = do_div(temp_len, mtd->erasesize);
+
+ if (rem) {
pr_debug("%s: length not block aligned\n", __func__);
ret = -EINVAL;
}
--
1.9.1
next reply other threads:[~2015-09-30 8:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-30 8:35 Sudip Mukherjee [this message]
2015-09-30 8:50 ` [PATCH] mtd: mtdram: fix build error kbuild test robot
2015-09-30 9:28 ` kbuild test robot
2015-09-30 9:46 ` Sudip Mukherjee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1443602158-631-1-git-send-email-sudipm.mukherjee@gmail.com \
--to=sudipm.mukherjee@gmail.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=sfr@canb.auug.org.au \
--cc=yangds.fnst@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).