mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00
pickit2_spi.c: Use one variable to store raw parameter values
Currently, each programmer parameter has their own temp variable to store their raw value into it. That's not needed since these variables are only used for a short time to do some configuration and stay unused then. Thus, use only one variable for all of them. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: Ib4ebc0e6354aad007145e1b0a761d9011c59ff7c Reviewed-on: https://review.coreboot.org/c/flashrom/+/66571 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
This commit is contained in:
parent
fddcc379dc
commit
d4a46375da
@ -410,28 +410,30 @@ static int pickit2_spi_init(void)
|
|||||||
libusb_device_handle *pickit2_handle;
|
libusb_device_handle *pickit2_handle;
|
||||||
struct pickit2_spi_data *pickit2_data;
|
struct pickit2_spi_data *pickit2_data;
|
||||||
int spispeed_idx = 0;
|
int spispeed_idx = 0;
|
||||||
char *spispeed = extract_programmer_param_str("spispeed");
|
char *param_str;
|
||||||
if (spispeed != NULL) {
|
|
||||||
|
param_str = extract_programmer_param_str("spispeed");
|
||||||
|
if (param_str != NULL) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; spispeeds[i].name; i++) {
|
for (; spispeeds[i].name; i++) {
|
||||||
if (strcasecmp(spispeeds[i].name, spispeed) == 0) {
|
if (strcasecmp(spispeeds[i].name, param_str) == 0) {
|
||||||
spispeed_idx = i;
|
spispeed_idx = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (spispeeds[i].name == NULL) {
|
if (spispeeds[i].name == NULL) {
|
||||||
msg_perr("Error: Invalid 'spispeed' value.\n");
|
msg_perr("Error: Invalid 'spispeed' value.\n");
|
||||||
free(spispeed);
|
free(param_str);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
free(spispeed);
|
free(param_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
int millivolt = 3500;
|
int millivolt = 3500;
|
||||||
char *voltage = extract_programmer_param_str("voltage");
|
param_str = extract_programmer_param_str("voltage");
|
||||||
if (voltage != NULL) {
|
if (param_str != NULL) {
|
||||||
millivolt = parse_voltage(voltage);
|
millivolt = parse_voltage(param_str);
|
||||||
free(voltage);
|
free(param_str);
|
||||||
if (millivolt < 0)
|
if (millivolt < 0)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user