public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi@samsung.com>
To: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: dbaryshkov@gmail.com, dwmw2@infradead.org,
	myungjoo.ham@samsung.com, kyungmin.park@samsung.com,
	linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH] charger-manager: Fix checking of wrong return type
Date: Fri, 28 Mar 2014 09:52:48 +0900	[thread overview]
Message-ID: <5334C7E0.8050803@samsung.com> (raw)
In-Reply-To: <1764333.udFThjx8n5@amdc1032>

Hi,

On 03/28/2014 01:52 AM, Bartlomiej Zolnierkiewicz wrote:
> 
> Hi,
> 
> On Thursday, March 27, 2014 08:56:55 PM Chanwoo Choi wrote:
>> This patch fix minor issue about checking wrong return type.
>>
>> The of_cm_parse_desc() return ERR_PTR(errnor number) when some error happen
>> in this function. But, charger_manager_probe() has only checked whether
>> desc is NULL or not. If of_cm_parse_desc() returns ERR_PTR(-ENOMEM), desc
>> isn't NULL but desc is (void *)(-ENOMEM). Althouhg some error happen for parsing
>> DT, charger_manager_probe() can't detect error of desc instance.
>>
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
>> ---
>>  drivers/power/charger-manager.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
>> index 9e4dab4..a10fb57 100644
>> --- a/drivers/power/charger-manager.c
>> +++ b/drivers/power/charger-manager.c
>> @@ -1677,7 +1677,7 @@ static int charger_manager_probe(struct platform_device *pdev)
>>  		}
>>  	}
>>  
>> -	if (!desc) {
>> +	if (IS_ERR(desc)) {
>>  		dev_err(&pdev->dev, "No platform data (desc) found\n");
>>  		return -ENODEV;
> 
> While you are at it you may also fix the code to return the proper error
> code.  of_cm_parse_desc() currently returns -ENOMEM not -ENODEV but it
> would be even better to decode the actual return code from desc by using
> 'return PTR_ERR(desc)' instead of 'return -ENODEV'.

I'll resend this patch after fix it.

Thanks,
Chanwoo Choi



      reply	other threads:[~2014-03-28  0:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27 11:56 [RESEND PATCH] charger-manager: Fix checking of wrong return type Chanwoo Choi
2014-03-27 16:52 ` Bartlomiej Zolnierkiewicz
2014-03-28  0:52   ` Chanwoo Choi [this message]

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=5334C7E0.8050803@samsung.com \
    --to=cw00.choi@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=dbaryshkov@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    /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