public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Patryk Duda <pdk@semihalf.com>
To: devel@edk2.groups.io
Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org,
	mw@semihalf.com, jsd@semihalf.com, Patryk Duda <pdk@semihalf.com>
Subject: [edk2-platforms: PATCH 1/2] Marvell/Drivers: MvSpiFlashDxe: Fix sector number obtaining
Date: Mon,  9 Sep 2019 17:52:11 +0200	[thread overview]
Message-ID: <20190909155212.30338-2-pdk@semihalf.com> (raw)
In-Reply-To: <20190909155212.30338-1-pdk@semihalf.com>

This commit fixes bug which was causing one sector of bytes to be
ommited. It was discovered when bytes to be written was 0 in last block,
but total count of bytes was multiplication of sector size. It turned
out that in every case one sector of data was missing.

This bug can be fixed in various ways, but this solution fixes hypotetical
situation in which total bytes count is smaller than sector size.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
---
 Silicon/Marvell/Drivers/Spi/MvSpiFlashDxe/MvSpiFlashDxe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Silicon/Marvell/Drivers/Spi/MvSpiFlashDxe/MvSpiFlashDxe.c b/Silicon/Marvell/Drivers/Spi/MvSpiFlashDxe/MvSpiFlashDxe.c
index 02bc281c8b..db12adb764 100755
--- a/Silicon/Marvell/Drivers/Spi/MvSpiFlashDxe/MvSpiFlashDxe.c
+++ b/Silicon/Marvell/Drivers/Spi/MvSpiFlashDxe/MvSpiFlashDxe.c
@@ -388,7 +388,7 @@ MvSpiFlashUpdateWithProgress (
   UINT8 *TmpBuf;
 
   SectorSize = Slave->Info->SectorSize;
-  SectorNum = ByteCount / SectorSize;
+  SectorNum = (ByteCount / SectorSize) + 1;
   ToUpdate = SectorSize;
 
   TmpBuf = (UINT8 *)AllocateZeroPool (SectorSize);
-- 
2.21.0


  reply	other threads:[~2019-09-09 15:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-09 15:52 [edk2-platforms: PATCH 0/2] Armada 7k8k SPI flash driver improvements Patryk Duda
2019-09-09 15:52 ` Patryk Duda [this message]
2019-09-28 22:37   ` [edk2-platforms: PATCH 1/2] Marvell/Drivers: MvSpiFlashDxe: Fix sector number obtaining Leif Lindholm
2019-09-09 15:52 ` [edk2-platforms: PATCH 2/2] Marvell/Drivers: MvSpiFlashDxe: Implement progress bar Patryk Duda
2019-09-28 22:47   ` Leif Lindholm
2019-09-10  6:23 ` [edk2-platforms: PATCH 0/2] Armada 7k8k SPI flash driver improvements Marcin Wojtas
2019-09-27 14:48   ` Patryk Duda

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-list 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=20190909155212.30338-2-pdk@semihalf.com \
    --to=devel@edk2.groups.io \
    /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