From: jonghwa3.lee-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org
To: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Anton Vorontsov <anton-9xeibp6oKSgdnm+yROfE0A@public.gmane.org>
Subject: Re: charger-manager: Modify the way of checking battery's temperature
Date: Tue, 07 Jan 2014 17:05:42 +0900 [thread overview]
Message-ID: <52CBB556.2090302@samsung.com> (raw)
In-Reply-To: <20140107073951.GA17969-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
Hi,
On 2014년 01월 07일 16:39, Dan Carpenter wrote:
> Hello Jonghwa Lee,
>
> The patch 5c49a6256bed: "charger-manager: Modify the way of checking
> battery's temperature" from Dec 18, 2013, leads to the following
> static checker warning:
>
> drivers/power/charger-manager.c:563 cm_get_battery_temperature()
> warn: passing casted pointer 'temp' to 'thermal_zone_get_temp()' 32 vs 64.
>
> drivers/power/charger-manager.c
> 554 static int cm_get_battery_temperature(struct charger_manager *cm,
> 555 int *temp)
> 556 {
> 557 int ret;
> 558
> 559 if (!cm->desc->measure_battery_temp)
> 560 return -ENODEV;
> 561
> 562 #ifdef CONFIG_THERMAL
> 563 ret = thermal_zone_get_temp(cm->tzd_batt, (unsigned long *)temp);
> ^^^^^^^^^^^^^^^^^^^^^^
> This will corrupt memory on 64 bit systems.
>
> 564 if (!ret)
> 565 /* Calibrate temperature unit */
> 566 *temp /= 100;
> 567 #else
> 568 ret = cm->fuel_gauge->get_property(cm->fuel_gauge,
> 569 POWER_SUPPLY_PROP_TEMP,
> 570 (union power_supply_propval *)temp);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> This will corrupt memory as well. Some of the callers pass an actual
> 32 bit integer and not a 64 bit union.
>
> 571 #endif
> 572 return ret;
> 573 }
>
Sorry, I carelessly used typecasting. I'll clean these up.
Thanks for advice.
Thanks,
Jonghwa
> regards,
> dan carpenter
>
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2014-01-07 8:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-07 7:39 charger-manager: Modify the way of checking battery's temperature Dan Carpenter
[not found] ` <20140107073951.GA17969-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
2014-01-07 8:05 ` jonghwa3.lee-Sze3O3UU22JBDgjK7y7TUQ [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=52CBB556.2090302@samsung.com \
--to=jonghwa3.lee-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \
--cc=anton-9xeibp6oKSgdnm+yROfE0A@public.gmane.org \
--cc=dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/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