Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report errors returned by _qspi_configure_format #11603

Merged
merged 3 commits into from
Oct 18, 2019

Conversation

kyle-cypress
Copy link

Description

The function returns a qspi_status_t but most usages in QSPIFBlockDevice assume that it always succeeds.

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[x] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

Release Notes

@ciarmcom
Copy link
Member

@kyle-cypress, thank you for your changes.
@ARMmbed/mbed-os-storage @ARMmbed/mbed-os-maintainers please review.

@SeppoTakalo
Copy link
Contributor

I like the fixes, but I don't like to extend more error codes into the system.
It is a pain to maintain and document.

To me the _qspi_configure_format() sounds like it will always pass or always fails on my device, depending whether I'm passing right parameters. Therefore QSPIF_BD_ERROR_DEVICE_ERROR should be sufficient error code.

The driver can produce more info by doing tr_error() call, so that while you are debugging the device, you will see that actual problem. But once running in the field, more error codes don't make sense.

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM , just a question about error numbering

Edit: rethinking my review after the above comment, missed it prior reviewing

QSPIF_BD_ERROR_INVALID_ERASE_PARAMS = -4005, /* Erase command not on sector aligned addresses or exceeds device size */
QSPIF_BD_ERROR_DEVICE_NOT_UNIQE = -4006, /* Only one instance per csel is allowed */
QSPIF_BD_ERROR_DEVICE_MAX_EXCEED = -4007 /* Max active QSPIF devices exceeded */
QSPIF_BD_ERROR_CONF_FORMAT_FAILED = -4005, /* Configure format failed */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QSPIF_BD_ERROR_CONF_FORMAT_FAILED shall this be 4008? Or this follows _FAILED thus placed irght after the latest failure status and the rest is shifted.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is made moot by 5b3b147 which removes the new error code entirely.

@0xc0170 0xc0170 self-requested a review October 1, 2019 10:38
@0xc0170
Copy link
Contributor

0xc0170 commented Oct 1, 2019

@SeppoTakalo Acceptable patch would be to revert adding new error code and use QSPIF_BD_ERROR_DEVICE_ERROR instead ?

@SeppoTakalo
Copy link
Contributor

Yes.

When no new error codes are added, it does not change the API and is acceptable as a "fix" into the next patch release.

@bulislaw
Copy link
Member

bulislaw commented Oct 1, 2019

When no new error codes are added, it does not change the API and is acceptable as a "fix" into the next patch release.

Agreed

Copy link
Contributor

@SeppoTakalo SeppoTakalo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -302,17 +306,23 @@ int QSPIFBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
_mutex.lock();
Copy link
Contributor

@VeijoPesonen VeijoPesonen Oct 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to release this. Could you also check all the places where the code decides to jump to goto exit_point-label as the the same issue seems to be found also from other functions inside this file. Scratch that, other places seem to be fine.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to follow the goto exit_point pattern used everywhere else.

@adbridge
Copy link
Contributor

CI started

@mbed-ci
Copy link

mbed-ci commented Oct 11, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

@adbridge
Copy link
Contributor

@kyle-cypress looks like this needs a rebase

@kyle-cypress
Copy link
Author

Rebased

Kyle Kearney added 2 commits October 11, 2019 14:28
The function returns a qspi_status_t but most usages in QSPIFBlockDevice
assume that it always succeeds.
Use QSPIF_BD_ERROR_DEVICE_ERROR instead of introducing a new error code.
Add tr_error calls whenever _qspi_configure_format fails to aid in debugging.
@kyle-cypress kyle-cypress force-pushed the pr/qspi-bd-format-error branch from 9730ee2 to 3f20b80 Compare October 11, 2019 21:29
Copy link
Contributor

@VeijoPesonen VeijoPesonen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my previous comment.

Update to follow the same `goto exit_point` pattern that is used
by the rest of the functions to avoid leaving the mutex locked
when errors are detected and require the function to abort.
@kyle-cypress
Copy link
Author

Please see my previous comment.

I missed the non-struck-out text at the beginning before. Should be fixed now.

Copy link
Contributor

@VeijoPesonen VeijoPesonen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@jeromecoutant
Copy link
Collaborator

Hi
Quick test with N25Q128A and MX25R6435F seems OK,

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 17, 2019

CI restarted

@mbed-ci
Copy link

mbed-ci commented Oct 17, 2019

Test run: FAILED

Summary: 1 of 4 test jobs failed
Build number : 2
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-IAR

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 17, 2019

There's internal CI license issue, we are investigating.

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 18, 2019

CI restarted

@mbed-ci
Copy link

mbed-ci commented Oct 18, 2019

Test run: FAILED

Summary: 7 of 11 test jobs failed
Build number : 3
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_cloud-client-test
  • jenkins-ci/mbed-os-ci_mbed2-build-ARM
  • jenkins-ci/mbed-os-ci_dynamic-memory-usage
  • jenkins-ci/mbed-os-ci_greentea-test
  • jenkins-ci/mbed-os-ci_mbed2-build-IAR
  • jenkins-ci/mbed-os-ci_exporter
  • jenkins-ci/mbed-os-ci_mbed2-build-GCC_ARM

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 18, 2019

CI restarted

@mbed-ci
Copy link

mbed-ci commented Oct 18, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 4
Build artifacts

@0xc0170 0xc0170 merged commit 7ba151a into ARMmbed:master Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants