linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* mtd/sm_ftl.c: fix wrong do_div() usage
@ 2015-11-04 20:21 Nicolas Pitre
  2015-11-16 23:11 ` Brian Norris
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Pitre @ 2015-11-04 20:21 UTC (permalink / raw)
  To: David Woodhouse, Brian Norris; +Cc: linux-mtd

do_div() is meant to be used with an unsigned dividend.

Signed-off-by: Nicolas Pitre <nico@linaro.org>

diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c
index c23184a47f..b096f8bb05 100644
--- a/drivers/mtd/sm_ftl.c
+++ b/drivers/mtd/sm_ftl.c
@@ -206,9 +206,10 @@ static loff_t sm_mkoffset(struct sm_ftl *ftl, int zone, int block, int boffset)
 }
 
 /* Breaks offset into parts */
-static void sm_break_offset(struct sm_ftl *ftl, loff_t offset,
+static void sm_break_offset(struct sm_ftl *ftl, loff_t loffset,
 			    int *zone, int *block, int *boffset)
 {
+	u64 offset = loffset;
 	*boffset = do_div(offset, ftl->block_size);
 	*block = do_div(offset, ftl->max_lba);
 	*zone = offset >= ftl->zone_count ? -1 : offset;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: mtd/sm_ftl.c: fix wrong do_div() usage
  2015-11-04 20:21 mtd/sm_ftl.c: fix wrong do_div() usage Nicolas Pitre
@ 2015-11-16 23:11 ` Brian Norris
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Norris @ 2015-11-16 23:11 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: David Woodhouse, linux-mtd

On Wed, Nov 04, 2015 at 03:21:21PM -0500, Nicolas Pitre wrote:
> do_div() is meant to be used with an unsigned dividend.
> 
> Signed-off-by: Nicolas Pitre <nico@linaro.org>

Pushed to l2-mtd.git. Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-16 23:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-04 20:21 mtd/sm_ftl.c: fix wrong do_div() usage Nicolas Pitre
2015-11-16 23:11 ` Brian Norris

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).