sf: fix timebase data type in _wait_ready()
PATCH 1/1 sf: fix timebase data type in _wait_ready()
From: Stephen Warren <[email protected]>
get_timer() returns an unsigned 64-bit value, but is currently assigned to a signed 32-bit variable. Due to sign extension and data truncation, this causes the timeout loop in spi_flash_cmd_wait_ready() to immediately (and incorrectly) fire for about 50% of all time values, based on whether bit 31 is set. In sandbox at least, this causes the test to pass or fail based on system uptime, as opposed to time since the U-Boot binary was started.
--- drivers/mtd/spi/spi_flash.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mtd/spi/spi_flash.c +2 -1
@@ -265,7 +265,8 @@ static int spi_flash_ready(struct spi_flash *flash)static int spi_flash_cmd_wait_ready (struct spi_flash *flash,unsigned long timeout) { -int timebase, ret; +unsigned long timebase; +int ret; timebase =get_timer (0 );
Signature · 1 line
2.8.1
PATCH 1/1 sf: fix timebase data type in _wait_ready()
Quoted 11 lines · Stephen Warren
From: Stephen Warren <[email protected]>
get_timer()returns an unsigned 64-bit value, but is currently assigned to a signed 32-bit variable. Due to sign extension and data truncation, this causes the timeout loop inspi_flash_cmd_wait_ready()to immediately (and incorrectly) fire for about 50% of all time values, based on whether bit 31 is set. In sandbox at least, this causes the test to pass or fail based on system uptime, as opposed to time since the U-Boot binary was started.Fixes 4efad20a1751 ("sf: Update status reg check in spi_flash_cmd_wait_ready")Signed-off-by Stephen Warren <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160404/3bea6f8f/attachment.sig>
PATCH 1/1 sf: fix timebase data type in _wait_ready()
Quoted 11 lines · Tom Rini
Quoted 9 lines · Stephen Warren
From: Stephen Warren <[email protected]>
get_timer()returns an unsigned 64-bit value, but is currently assigned to a signed 32-bit variable. Due to sign extension and data truncation, this causes the timeout loop inspi_flash_cmd_wait_ready()to immediately (and incorrectly) fire for about 50% of all time values, based on whether bit 31 is set. In sandbox at least, this causes the test to pass or fail based on system uptime, as opposed to time since the U-Boot binary was started.
Quoted 4 lines
Quoted 2 lines
Fixes 4efad20a1751 ("sf: Update status reg check in spi_flash_cmd_wait_ready")Signed-off-by Stephen Warren <[email protected]>Reviewed-by Tom Rini <[email protected]>
Signature · 1 line
Jagan.
PATCH 1/1 sf: fix timebase data type in _wait_ready()
Quoted 12 lines · Jagan Teki
Quoted 11 lines · Tom Rini
Quoted 9 lines · Stephen Warren
From: Stephen Warren <[email protected]>
get_timer()returns an unsigned 64-bit value, but is currently assigned to a signed 32-bit variable. Due to sign extension and data truncation, this causes the timeout loop inspi_flash_cmd_wait_ready()to immediately (and incorrectly) fire for about 50% of all time values, based on whether bit 31 is set. In sandbox at least, this causes the test to pass or fail based on system uptime, as opposed to time since the U-Boot binary was started.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Fixes 4efad20a1751 ("sf: Update status reg check in spi_flash_cmd_wait_ready")Signed-off-by Stephen Warren <[email protected]>Reviewed-by Tom Rini <[email protected]>Reviewed-by Jagan Teki <[email protected]>
It'd be great if this could be applied to fix the final test/py failure on sandbox.
PATCH 1/1 sf: fix timebase data type in _wait_ready()
Quoted 16 lines · Stephen Warren
Quoted 15 lines · Jagan Teki
Quoted 14 lines · Tom Rini
Quoted 11 lines · Stephen Warren
From: Stephen Warren <[email protected]>
get_timer()returns an unsigned 64-bit value, but is currently assigned to a signed 32-bit variable. Due to sign extension and data truncation, this causes the timeout loop inspi_flash_cmd_wait_ready()to immediately (and incorrectly) fire for about 50% of all time values, based on whether bit 31 is set. In sandbox at least, this causes the test to pass or fail based on system uptime, as opposed to time since the U-Boot binary was started.Fixes 4efad20a1751 ("sf: Update status reg check in spi_flash_cmd_wait_ready")Signed-off-by Stephen Warren <[email protected]>
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Reviewed-by Tom Rini <[email protected]>Reviewed-by Jagan Teki <[email protected]>It'd be great if this could be applied to fix the final test/py failure on sandbox.
Yes, please, lets get some PRs with fixes in now :) Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160412/e256fec9/attachment.sig>
PATCH 1/1 sf: fix timebase data type in _wait_ready()
In reply to Jagan TekiQuoted 12 lines · Jagan Teki
Quoted 11 lines · Tom Rini
Quoted 9 lines · Stephen Warren
From: Stephen Warren <[email protected]>
get_timer()returns an unsigned 64-bit value, but is currently assigned to a signed 32-bit variable. Due to sign extension and data truncation, this causes the timeout loop inspi_flash_cmd_wait_ready()to immediately (and incorrectly) fire for about 50% of all time values, based on whether bit 31 is set. In sandbox at least, this causes the test to pass or fail based on system uptime, as opposed to time since the U-Boot binary was started.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Fixes 4efad20a1751 ("sf: Update status reg check in spi_flash_cmd_wait_ready")Signed-off-by Stephen Warren <[email protected]>Reviewed-by Tom Rini <[email protected]>Reviewed-by Jagan Teki <[email protected]>
Jagan, are you going to apply this?
PATCH 1/1 sf: fix timebase data type in _wait_ready()
Quoted 23 lines · Stephen Warren
Quoted 22 lines · Jagan Teki
Quoted 21 lines · Tom Rini
Quoted 18 lines · Stephen Warren
From: Stephen Warren <[email protected]>
get_timer()returns an unsigned 64-bit value, but is currently assigned to
a signed 32-bit variable. Due to sign extension and data truncation, this
causes the timeout loop inspi_flash_cmd_wait_ready()to immediately (and
incorrectly) fire for about 50% of all time values, based on whether bit
31 is set. In sandbox at least, this causes the test to pass or fail based
on system uptime, as opposed to time since the U-Boot binary was started.Fixes 4efad20a1751 ("sf: Update status reg check in
spi_flash_cmd_wait_ready")Signed-off-by Stephen Warren <[email protected]>
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Reviewed-by Tom Rini <[email protected]>Reviewed-by Jagan Teki <[email protected]>Jagan, are you going to apply this?
Tom, does it make sense for you to apply this?
PATCH 1/1 sf: fix timebase data type in _wait_ready()
Quoted 24 lines · Stephen Warren
Quoted 23 lines · Stephen Warren
Quoted 22 lines · Jagan Teki
Quoted 21 lines · Tom Rini
Quoted 18 lines · Stephen Warren
From: Stephen Warren <[email protected]>
get_timer()returns an unsigned 64-bit value, but is currently assigned to
a signed 32-bit variable. Due to sign extension and data truncation, this
causes the timeout loop inspi_flash_cmd_wait_ready()to immediately (and
incorrectly) fire for about 50% of all time values, based on whether bit
31 is set. In sandbox at least, this causes the test to pass or fail based
on system uptime, as opposed to time since the U-Boot binary was started.Fixes 4efad20a1751 ("sf: Update status reg check in
spi_flash_cmd_wait_ready")Signed-off-by Stephen Warren <[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Reviewed-by Tom Rini <[email protected]>Reviewed-by Jagan Teki <[email protected]>Jagan, are you going to apply this?
Tom, does it make sense for you to apply this?
If Jagan doesn't want to make up a small PR for this, yes. And since I should do an rc3 today, yes, I should pick this up myself. Thanks for the reminder.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160425/3137f755/attachment.sig>
Quoted 9 lines · Stephen Warren
From: Stephen Warren <[email protected]>
get_timer()returns an unsigned 64-bit value, but is currently assigned to a signed 32-bit variable. Due to sign extension and data truncation, this causes the timeout loop inspi_flash_cmd_wait_ready()to immediately (and incorrectly) fire for about 50% of all time values, based on whether bit 31 is set. In sandbox at least, this causes the test to pass or fail based on system uptime, as opposed to time since the U-Boot binary was started.
Quoted 4 lines
Fixes 4efad20a1751 ("sf: Update status reg check in spi_flash_cmd_wait_ready")Signed-off-by Stephen Warren <[email protected]>Reviewed-by Tom Rini <[email protected]>Reviewed-by Jagan Teki <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160425/3da6bf8a/attachment.sig>