[coreboot] [PATCH] chipset_enable: Fix open /dev/cpu

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Wed May 6 00:30:56 CEST 2009


On 06.05.2009 00:19, Myles Watson wrote:
>   
>> -----Original Message-----
>> From: coreboot-bounces at coreboot.org [mailto:coreboot-bounces at coreboot.org]
>> On Behalf Of Carl-Daniel Hailfinger
>> Sent: Tuesday, May 05, 2009 4:12 PM
>> To: Beber
>> Cc: coreboot at coreboot.org
>> Subject: Re: [coreboot] [PATCH] chipset_enable: Fix open /dev/cpu
>>
>> Hi Bertrand,
>>
>> On 05.05.2009 22:22, Beber wrote:
>>     
>>> Here is a fix for chipset_enable.c when there is not /dev/cpu. Open
>>> fail no there is not reason to lseek in. Actually this is a trivial fix
>>> for not well handled return from open.
>>>
>>>       
>> Although the fix seems trivial, it breaks the code a few lines down.
>> With the old code, you got a meaningful error message about having to
>> run "modprobe msr". This error message does not trigger anymore with the
>> new code.
>> Please fix. Thanks.
>>     
>
> Is this what you're asking for?
>   

Partially. I think it would make sense to unify this with the first
lseek() error check, but I don't have strong preferences either way.

> Index: util/flashrom/chipset_enable.c
> ===================================================================
> --- util/flashrom/chipset_enable.c	(revision 462)
> +++ util/flashrom/chipset_enable.c	(working copy)
> @@ -512,7 +512,8 @@
>  
>  	fd_msr = open("/dev/cpu/0/msr", O_RDWR);
>  	if (fd_msr == -1) {
> -		perror("open msr");
> +		perror("open /dev/cpu/0/msr");
> +		printf("Cannot open MSR. Did you run 'modprobe msr'?\n");
>  		return -1;
>  	}
>
>   

If you think this is the preferred fix, I'll ack it once you signoff.

Regards,
Carl-Daniel

-- 
http://www.hailfinger.org/





More information about the coreboot mailing list