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

Lukasz Majewski l.majewski at samsung.com
Mon Dec 10 10:32:24 CET 2012


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;


> 
> Best regards,
> 
> Wolfgang Denk
> 



-- 
Best regards,

Lukasz Majewski

Samsung Poland R&D Center | Linux Platform Group


More information about the U-Boot mailing list