From mboxrd@z Thu Jan 1 00:00:00 1970 From: Minkyu Kang Date: Mon, 10 Dec 2012 18:59:44 +0900 Subject: [U-Boot] universal_c210: fix compiler error and compiler warning In-Reply-To: <20121210103224.372c572e@amdc308.digital.local> References: <50C58623.3090308@samsung.com> <20121210090642.5B787201212@gemini.denx.de> <20121210103224.372c572e@amdc308.digital.local> Message-ID: <50C5B290.5010101@samsung.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Wolfgang, On 10/12/12 18:32, Lukasz Majewski wrote: > Hi Wolfgang, > >> Dear Minkyu Kang, >> >> In message <50C58623.3090308@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.