Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1437269 > unrolled thread
| Started by | Markus Mayer <mmayer@broadcom.com> |
|---|---|
| First post | 2016-07-05 22:50 +0200 |
| Last post | 2016-07-05 22:50 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 7/7] power_supply: make use of new strcpytoupper() function Markus Mayer <mmayer@broadcom.com> - 2016-07-05 22:50 +0200
| From | Markus Mayer <mmayer@broadcom.com> |
|---|---|
| Date | 2016-07-05 22:50 +0200 |
| Subject | [PATCH v2 7/7] power_supply: make use of new strcpytoupper() function |
| Message-ID | <rRFs5-7Ol-13@gated-at.bofh.it> |
Call strcpytoupper() rather than walking the string explicitly to
convert it to uppercase.
Signed-off-by: Markus Mayer <mmayer@broadcom.com>
---
drivers/power/power_supply_sysfs.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
index 80fed98..20fdcc5 100644
--- a/drivers/power/power_supply_sysfs.c
+++ b/drivers/power/power_supply_sysfs.c
@@ -256,19 +256,16 @@ void power_supply_init_attrs(struct device_type *dev_type)
static char *kstruprdup(const char *str, gfp_t gfp)
{
- char *ret, *ustr;
+ char *ustr;
- ustr = ret = kmalloc(strlen(str) + 1, gfp);
+ ustr = kmalloc(strlen(str) + 1, gfp);
- if (!ret)
+ if (!ustr)
return NULL;
- while (*str)
- *ustr++ = toupper(*str++);
+ strcpytoupper(ustr, str);
- *ustr = 0;
-
- return ret;
+ return ustr;
}
int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)
--
2.7.4
Back to top | Article view | linux.kernel
csiph-web