[U-Boot] universal_c210: fix compiler error and compiler warning

Minkyu Kang mk7.kang at samsung.com
Mon Dec 10 10:59:44 CET 2012


Dear Wolfgang,

On 10/12/12 18:32, Lukasz Majewski wrote:
> Hi Wolfgang,
> 
>> Dear Minkyu Kang,
>>
>> In message <50C58623.3090308 at samsung.com> you wrote:
>> ...
>>> @@ -337,7 +341,7 @@ static void init_pmic_lcd(void)
>>>  	unsigned char val;
>>>  	int ret = 0;
>>>  
>>> -	struct pmic *p = get_pmic();
>>> +	struct pmic *p = pmic_get("MAX8998_PMIC");
>>>  
>>>  	if (pmic_probe(p))
>>>  		return;
>>> @@ -428,7 +432,7 @@ static void reset_lcd(void)
>>>  
>>>  static void lcd_power_on(void)
>>>  {
>>> -	struct pmic *p = get_pmic();
>>> +	struct pmic *p = pmic_get("MAX8998_PMIC");
>>>  
>>>  	if (pmic_probe(p))
>>>  		return;
>>
>> This is unrelated to your patch - but what if pmic_get() returns NULL?
>>
>> pmic_probe() will crashif you pass it a NULL pointer...
> 
> The PMIC 2.0 uses malloc to allocate pmic structure.
> 
> The fix, which has been proposed would work for old pmic.
> 
> In the new one PMIC 2.0, we require to test return pointer from
> pmic_get() (similar to all malloc allocations):
> 
> struct pmic *p = pmic_get("MAX8998_PMIC");
> if (!p)
> 	return -ENODEV;
> 

I will fix it by another patch.

Thanks.
Minkyu Kang.



More information about the U-Boot mailing list