public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fs: fat: fix bug when write size is less than a sector size
Date: Fri, 19 Jul 2013 13:20:34 +0200	[thread overview]
Message-ID: <20130719112034.C5F09380ADF@gemini.denx.de> (raw)
In-Reply-To: <51E90A3D.6000007@atmel.com>

Dear Josh Wu,

In message <51E90A3D.6000007@atmel.com> you wrote:
> 
> > Why would this be needed?  The case of a partial write is covered
> > further down below in the code, in the "if (size % mydata->sect_size)"
> > part...
> 
> The call of disk_write() will pass the sector size as 0. That will cause 
> the mmc driver stalled.

I think instead of "sector size" you mean the number of sectors.  The
sector size is fixed.

Big question: why should we call disk_write() at all when the count is
zero? Maybe a simple

	if ((size / mydata->sect_size) > 0) {
		if (disk_write(startsect, size / mydata->sect_size, buffer) < 0) {
			...
		}
	}

would fix this issue?


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Der Irrtum wiederholt sich immerfort in der Tat.  Deshalb mu? man das
Wahre unerm?dlich in Worten wiederholen.                     - Goethe

  reply	other threads:[~2013-07-19 11:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-18  8:07 [U-Boot] [PATCH] fs: fat: fix bug when write size is less than a sector size Josh Wu
2013-07-18  8:24 ` Wolfgang Denk
2013-07-19  9:43   ` Josh Wu
2013-07-19 11:20     ` Wolfgang Denk [this message]
2013-07-23 10:16       ` Josh Wu

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=20130719112034.C5F09380ADF@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /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