Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/54190 )
Change subject: stlinkv3_spi.c: Cleanup properly on all init error paths
......................................................................
stlinkv3_spi.c: Cleanup properly on all init error paths
Do a cleanup: close handle and exit usb context in cases when init
fails.
If register_spi_master() fails, going to err_exit cleanup is not
needed because at that point shutdown function has already been
registered and it does the job.
BUG=b:185191942
TEST=builds
Change-Id: I9fabf48068635593bc86006c9642d8569eee8447
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M stlinkv3_spi.c
1 file changed, 7 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/90/54190/1
diff --git a/stlinkv3_spi.c b/stlinkv3_spi.c
index 7e8336e..110e97c 100644
--- a/stlinkv3_spi.c
+++ b/stlinkv3_spi.c
@@ -464,6 +464,7 @@
char *speed_str = NULL;
char *serialno = NULL;
char *endptr = NULL;
+ int ret = 1;
libusb_init(&usb_ctx);
if (!usb_ctx) {
@@ -498,7 +499,8 @@
msg_perr("Please pass the parameter "
"with a simple non-zero number in kHz\n");
free(speed_str);
- return -1;
+ ret = -1;
+ goto err_exit;
}
free(speed_str);
}
@@ -510,11 +512,13 @@
goto err_exit;
if (register_spi_master(&spi_programmer_stlinkv3))
- goto err_exit;
+ return 1; /* shutdown function does cleanup */
return 0;
err_exit:
+ if (stlinkv3_handle)
+ libusb_close(stlinkv3_handle);
libusb_exit(usb_ctx);
- return 1;
+ return ret;
}
--
To view, visit https://review.coreboot.org/c/flashrom/+/54190
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I9fabf48068635593bc86006c9642d8569eee8447
Gerrit-Change-Number: 54190
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newchange
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons.
Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/54170 )
Change subject: programmer: Smoothen register_opaque_master() API
......................................................................
Patch Set 1:
(1 comment)
File nicintel_eeprom.c:
https://review.coreboot.org/c/flashrom/+/54170/comment/f6061d13_08916697
PS1, Line 489: return register_opaque_master(&opaque_master_nicintel_ee_82580, NULL);
My comment here: this has a piece of data (eecp), but the data was only passed to register_shutdown, and was not passed to register_opaque_master via opaque_master struct. Opaque master struct was const, and it stays const.
--
To view, visit https://review.coreboot.org/c/flashrom/+/54170
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id3adb4cf04ae04dbe87ddb96f30871cb5f7c8ff0
Gerrit-Change-Number: 54170
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Thu, 13 May 2021 03:29:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/54171 )
Change subject: programmer: Make use of new register_opaque_master() API
......................................................................
programmer: Make use of new register_opaque_master() API
Pass pointers to dynamically allocated data to
register_opaque_master(). This way we can avoid some mutable globals.
BUG=b:185191942
TEST=builds
Change-Id: I160810cd67f782131962e96fc6d20e2987fb0390
Signed-off-by: Anastasia Klimchuk <aklm(a)chromium.org>
---
M linux_mtd.c
1 file changed, 2 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/71/54171/1
diff --git a/linux_mtd.c b/linux_mtd.c
index aeaecce..a1af069 100644
--- a/linux_mtd.c
+++ b/linux_mtd.c
@@ -295,7 +295,7 @@
return 0;
}
-static struct opaque_master programmer_linux_mtd = {
+static const struct opaque_master programmer_linux_mtd = {
/* max_data_{read,write} don't have any effect for this programmer */
.max_data_read = MAX_DATA_UNSPECIFIED,
.max_data_write = MAX_DATA_UNSPECIFIED,
@@ -418,13 +418,12 @@
goto linux_mtd_init_exit;
}
- programmer_linux_mtd.data = data;
if (register_shutdown(linux_mtd_shutdown, (void *)data)) {
free(data);
goto linux_mtd_init_exit;
}
- register_opaque_master(&programmer_linux_mtd, NULL);
+ register_opaque_master(&programmer_linux_mtd, data);
ret = 0;
linux_mtd_init_exit:
--
To view, visit https://review.coreboot.org/c/flashrom/+/54171
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I160810cd67f782131962e96fc6d20e2987fb0390
Gerrit-Change-Number: 54171
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-MessageType: newchange
Attention is currently required from: Daniel Campello.
Peter Marheine has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/54147 )
Change subject: libflashrom: clear layout on flashrom_layout_release
......................................................................
Patch Set 3:
(2 comments)
Commit Message:
https://review.coreboot.org/c/flashrom/+/54147/comment/3c6aae79_221ea60e
PS2, Line 10: (as is currently always
: the case)
> Not --layout
As below, AFAICT you'll always get the global layout unless using IFD. Revised to reflect that.
https://review.coreboot.org/c/flashrom/+/54147/comment/53130542_e57a093c
PS2, Line 14: it's always the global layout
> how can user do this on libflashrom? I think the global layout is only used by cli_classic
Both flashrom_layout_read_fmap_* functions return a pointer to the global layout, so you'll only not get the global layout if you use IFD (as far as the libflashrom.h API goes).
--
To view, visit https://review.coreboot.org/c/flashrom/+/54147
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I8ba4b356f2a40ccbfd4e91f81af01d5f6a6de515
Gerrit-Change-Number: 54147
Gerrit-PatchSet: 3
Gerrit-Owner: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Daniel Campello <campello(a)chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Daniel Campello <campello(a)chromium.org>
Gerrit-Comment-Date: Thu, 13 May 2021 03:03:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Daniel Campello <campello(a)chromium.org>
Gerrit-MessageType: comment
Attention is currently required from: Peter Marheine.
Hello build bot (Jenkins), Edward O'Callaghan, Daniel Campello, Anastasia Klimchuk,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/54147
to look at the new patch set (#3).
Change subject: libflashrom: clear layout on flashrom_layout_release
......................................................................
libflashrom: clear layout on flashrom_layout_release
This changes the behavior of flashrom_layout_release to always clear the
provided layout, even if it is the global layout (as is currently always
the case unless using layout from IFD).
Not clearing it causes confusing behavior where a user may release a
layout and create a new one, but if that was the global layout
which wasn't cleared there will be stale information in the "new"
layout. This can easily lead to writing unexpected flash regions because
the API provides no way to stop including regions, and makes it
effectively impossible to stop including a region without completely
tearing down the library.
Change-Id: I8ba4b356f2a40ccbfd4e91f81af01d5f6a6de515
Signed-off-by: Peter Marheine <pmarheine(a)chromium.org>
---
M cli_classic.c
M flash.h
M layout.c
3 files changed, 8 insertions(+), 14 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/47/54147/3
--
To view, visit https://review.coreboot.org/c/flashrom/+/54147
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I8ba4b356f2a40ccbfd4e91f81af01d5f6a6de515
Gerrit-Change-Number: 54147
Gerrit-PatchSet: 3
Gerrit-Owner: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Daniel Campello <campello(a)chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-MessageType: newpatchset
Attention is currently required from: Peter Marheine.
Daniel Campello has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/54147 )
Change subject: libflashrom: clear layout on flashrom_layout_release
......................................................................
Patch Set 2:
(1 comment)
Commit Message:
https://review.coreboot.org/c/flashrom/+/54147/comment/2df3888b_cb66ad81
PS2, Line 10: (as is currently always
: the case)
> Not always the case... […]
Not --layout
--
To view, visit https://review.coreboot.org/c/flashrom/+/54147
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I8ba4b356f2a40ccbfd4e91f81af01d5f6a6de515
Gerrit-Change-Number: 54147
Gerrit-PatchSet: 2
Gerrit-Owner: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Reviewer: Anastasia Klimchuk <aklm(a)chromium.org>
Gerrit-Reviewer: Daniel Campello <campello(a)chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Peter Marheine <pmarheine(a)chromium.org>
Gerrit-Comment-Date: Thu, 13 May 2021 02:36:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Daniel Campello <campello(a)chromium.org>
Gerrit-MessageType: comment