[flashrom] [PATCH] Enable spi clock setting in dediprog driver

Nico Huber nico.huber at secunet.com
Wed Feb 20 10:23:59 CET 2013


Hello Carl-Daniel,

Am 19.02.2013 22:56, schrieb Carl-Daniel Hailfinger:
> Hi Nico,
> 
> I'm very sorry about the long review delay.
Anyway, thanks for your review.

> Am 16.11.2012 11:23 schrieb Nico Huber:
>> This adds a programmer parameter 'spispeed' to the dediprog driver to
>> control the transfer rate on the spi bus. The following rates are
>> available (in Hz):
>>   375k, 750k, 1.5M, 2.18M, 3M, 8M, 12M and 24M
>>
>> The original driver reinitializes the programmer after setting the
>> speed, so the initialization calls have moved into a new function
>> dediprog_setup() which is called twice.
>>
>> Signed-off-by: Nico Huber <nico.huber at secunet.com>
>>
>> diff --git a/dediprog.c b/dediprog.c
>> index a81cf83..60067a8 100644
>> --- a/dediprog.c
>> +++ b/dediprog.c
>> @@ -777,12 +779,21 @@ static int dediprog_shutdown(void *data)
>>  int dediprog_init(void)
>>  {
>>  	struct usb_device *dev;
>> -	char *voltage;
>> -	int millivolt = 3500;
>> -	int ret;
>> +	char *voltage, *spispeed;
>> +	int spispeed_idx = 2, millivolt = 3500;
>> +	int i, ret;
>>  
>>  	msg_pspew("%s\n", __func__);
>>  
>> +	spispeed = extract_programmer_param("spispeed");
>> +	if (spispeed) {
>> +		for (i = 0; spispeeds[i].name; ++i) {
>> +			if (!strcasecmp(spispeeds[i].name, spispeed)) {
>> +				spispeed_idx = i;
>> +				break;
>> +			}
>> +		}
>> +	}
> 
> No error handling for invalid strings, memory leak of spispeed.
> I have fixed the issues. See below for the updated patch.
Looks like I fixed the leak earlier, but didn't submit. Sorry.
> 
> If the updated patch is OK with you, I'll ack and commit.
Looks good to me.

Regards,
Nico




More information about the flashrom mailing list