From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Mon, 10 Dec 2012 11:44:48 +0100 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: <20121210104448.52307200FDD@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Lukasz Majewski, In message <20121210103224.372c572e@amdc308.digital.local> you wrote: > > > 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. ...and malloc() can fail. > 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; So this code here needs fixing. This is what I wanted to point out. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "If you want to eat hippopatomus, you've got to pay the freight." - attributed to an IBM guy, about why IBM software uses so much memory