public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Minkyu Kang <mk7.kang@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] universal_c210: fix compiler error and compiler warning
Date: Mon, 10 Dec 2012 18:59:44 +0900	[thread overview]
Message-ID: <50C5B290.5010101@samsung.com> (raw)
In-Reply-To: <20121210103224.372c572e@amdc308.digital.local>

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.

  reply	other threads:[~2012-12-10  9:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-10  6:50 [U-Boot] universal_c210: fix compiler error and compiler warning Minkyu Kang
2012-12-10  9:06 ` Wolfgang Denk
2012-12-10  9:32   ` Lukasz Majewski
2012-12-10  9:59     ` Minkyu Kang [this message]
2012-12-10 10:44     ` Wolfgang Denk
2012-12-10 10:28 ` Piotr Wilczek
2012-12-11  4:01 ` Minkyu Kang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50C5B290.5010101@samsung.com \
    --to=mk7.kang@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox