[yocto] [PATCH][linux-yocto-3.0] drivers/misc/pch_phub.c: don't oops if dmi_get_system_info returns NULL

Bruce Ashfield bruce.ashfield at windriver.com
Sat Jul 30 18:13:16 PDT 2011


On 11-07-30 2:34 PM, Khem Raj wrote:
> On Thursday, July 28, 2011 04:51:41 PM Darren Hart wrote:
>> Bruce,
>>
>> Please apply to yocto/base. Fixes a boot issue for a
>> tunnel creek development board.
>>
>> --
>>
>> commit 2b934c6236983392d01bef22e43af3051cac16f5
>>
>> If dmi_get_system_info() returns NULL, pch_phub_probe() will dereferencea
>> a zero pointer.
>>
>> This oops was observed on an Atom based board which has no BIOS, but a
>> bootloder which doesn't privde DMI data.
>>
>> Signed-off-by: Alexander Stein<alexander.stein at systec-electronic.com>
>> Cc: Tomoya MORINAGA<tomoya-linux at dsn.okisemi.com>
>> Cc: Greg KH<gregkh at suse.de>
>> Signed-off-by: Andrew Morton<akpm at linux-foundation.org>
>> Signed-off-by: Linus Torvalds<torvalds at linux-foundation.org>
>> ---
>>   drivers/misc/pch_phub.c |    5 ++++-
>>   1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
>> index 5fe79df..01eb67b 100644
>> --- a/drivers/misc/pch_phub.c
>> +++ b/drivers/misc/pch_phub.c
>> @@ -686,6 +686,8 @@ static int __devinit pch_phub_probe(struct pci_dev
>> *pdev, }
>>
>>   	if (id->driver_data == 1) { /* EG20T PCH */
>> +		const char *board_name;
>> +
>>   		retval = sysfs_create_file(&pdev->dev.kobj,
>>   					&dev_attr_pch_mac.attr);
>>   		if (retval)
>> @@ -701,7 +703,8 @@ static int __devinit pch_phub_probe(struct pci_dev
>> *pdev, CLKCFG_CANCLK_MASK);
>>
>>   		/* quirk for CM-iTC board */
>> -		if (strstr(dmi_get_system_info(DMI_BOARD_NAME), "CM-iTC"))
>> +		board_name = dmi_get_system_info(DMI_BOARD_NAME);
>> +		if (board_name&&  strstr(board_name, "CM-iTC"))
>
> May be it could be just if ( dmi_get_system_info(DMI_BOARD_NAME)&&
> strstr(board_name, "CM-iTC"))
>
> although I think compiler will already do it internally

Could very well be. I grabbed this one directly from linus' tree,
so I've got it as-is for now, but I've tagged it to be considered
later if we do decide that we want to send a tweak of this upstream

Thanks!

Bruce

>
>>   			pch_phub_read_modify_write_reg(chip,
>>   						(unsigned int)CLKCFG_REG_OFFSET,
>>   						CLKCFG_UART_48MHZ | CLKCFG_BAUDDIV |




More information about the yocto mailing list