From: rajanikanth.hv@linaro.org (Rajanikanth H V)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge
Date: Thu, 8 Nov 2012 00:15:47 +0530 (IST) [thread overview]
Message-ID: <alpine.DEB.2.02.1211072354150.5888@ubuntu12> (raw)
In-Reply-To: <509291FF.6090500@gmail.com>
On Thu, 1 Nov 2012, Francesco Lavra wrote:
[...]
>> + btech = of_get_property(np_bat_supply,
>> + "stericsson,battery-type", NULL);
>> + if (!btech) {
>> + dev_warn(dev, "missing property battery-name/type\n");
>> + strcpy(bat_tech, "UNKNOWN");
>> + } else {
>> + strcpy(bat_tech, btech);
>> + }
>
> I don't get the point of declaring the char array and copying the string
> in it, when you could simply use just the pointer returned by
> of_get_property().
I am considering a corner case where in 'battery-type' property is not
present and battery is connected.In this case i promote battery to
UNKNOWN from null.
FYI: Further, btemp driver will identify the connected battery based on
resistance value and decide to use.
Ref: ab8500_btemp_id(...) ab8500_btemp.c
> Anyway, if the string property is longer than 8 characters, you are
> writing past the size of the destination array.
i believe it is safe as power_supply.h comprises defines having battery
technology type in 4 characters length which is normally the case and
7 chars length being "UNKNOWN" seldom referred
next prev parent reply other threads:[~2012-11-07 18:45 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-31 15:40 [PATCH 0/4] Implement device tree support for ab8500 BM Devices Rajanikanth H.V
2012-10-31 15:40 ` [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge Rajanikanth H.V
2012-11-01 15:15 ` Francesco Lavra
2012-11-07 18:45 ` Rajanikanth H V [this message]
2012-11-10 16:53 ` Francesco Lavra
2012-11-15 11:34 ` Rajanikanth HV
2012-10-31 15:40 ` [PATCH 2/4] mfd: ab8500: add devicetree support for btemp Rajanikanth H.V
2012-10-31 15:40 ` [PATCH 3/4] mfd: ab8500: add devicetree support for charger Rajanikanth H.V
2012-10-31 15:40 ` [PATCH 4/4] mfd: ab8500: add devicetree support for chargalg Rajanikanth H.V
2012-11-19 3:46 ` [PATCH 0/4] Implement device tree support for ab8500 BM Devices Anton Vorontsov
2012-11-19 3:58 ` Rajanikanth HV
2012-11-19 4:57 ` Anton Vorontsov
-- strict thread matches above, loose matches on Subject: below --
2012-11-22 18:43 Rajanikanth H.V
2012-11-22 18:43 ` [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge Rajanikanth H.V
2012-11-22 20:08 ` Anton Vorontsov
2012-11-23 9:50 ` Lee Jones
2012-10-25 6:30 [PATCH 0/4] Implement device tree support for ab8500 BM Devices Rajanikanth H.V
2012-10-25 6:30 ` [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge Rajanikanth H.V
2012-10-27 15:07 ` Francesco Lavra
2012-10-27 16:00 ` Rajanikanth HV
2012-10-27 16:18 ` Francesco Lavra
2012-10-01 4:08 [PATCH 0/4] Implement device tree support for ab8500 BM Devices Rajanikanth H.V
2012-10-01 4:08 ` [PATCH 1/4] mfd: ab8500: add devicetree support for fuelgauge Rajanikanth H.V
2012-10-01 9:49 ` Lee Jones
2012-10-01 9:59 ` Rajanikanth HV
2012-10-01 10:36 ` Lee Jones
2012-10-01 10:22 ` Lee Jones
2012-10-06 14:01 ` Francesco Lavra
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=alpine.DEB.2.02.1211072354150.5888@ubuntu12 \
--to=rajanikanth.hv@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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