Displaying 20 results from an estimated 32 matches for "kstrtol".
Did you mean:
kstrtoul
2017 Jul 17
2
[PATCH] drm/nouveau/hwmon: Uninitialized variables in sysfs
kstrtol() and friends can return -EINVAL or -ERANGE. We have to test
for both, otherwise the value is possibly uninitialized. Also in some
of these files we accidentally return "count" on error instead of a
negative error code.
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>...
2017 Jul 22
0
[PATCH] drm/nouveau/hwmon: Uninitialized variables in sysfs
Reviewed-by: Pierre Moreau <pierre.morrow at free.fr>
On 2017-07-17 — 11:17, Dan Carpenter wrote:
> kstrtol() and friends can return -EINVAL or -ERANGE. We have to test
> for both, otherwise the value is possibly uninitialized. Also in some
> of these files we accidentally return "count" on error instead of a
> negative error code.
>
> Signed-off-by: Dan Carpenter <dan.carp...
2018 Jul 11
0
[PATCH] drm/nouveau/hwmon: potential uninitialized variables
Smatch complains that "value" can be uninitialized when kstrtol()
returns -ERANGE.
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
index 44178b4c3599..08a1ab6b150d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c
+++ b/drivers/gpu/drm/nouveau/no...
2017 Apr 26
0
[PATCH v5 3/5] nouveau_hwmon: Remove old code, add .write/.read operations
...attribute *a,
- const char *buf, size_t count)
+static int
+nouveau_hwmon_max_temp(struct nouveau_drm *drm)
{
- struct drm_device *dev = dev_get_drvdata(d);
- struct nouveau_drm *drm = nouveau_drm(dev);
struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
- long value;
- if (kstrtol(buf, 10, &value) == -EINVAL)
- return count;
-
- therm->attr_set(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK, value / 1000);
-
- return count;
+ return therm->attr_get(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK) * 1000;
}
-static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, nouveau_hwmon_max_tem...
2017 Apr 13
0
[PATCH 2/4] nouveau_hwmon: migrate to hwmon_device_register_with_info
...const char *buf, size_t count)
+
+static int
+nouveau_hwmon_set_max_temp(struct nouveau_drm *drm, long val)
{
- struct drm_device *dev = dev_get_drvdata(d);
- struct nouveau_drm *drm = nouveau_drm(dev);
struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
- long value;
- if (kstrtol(buf, 10, &value) == -EINVAL)
- return count;
-
- therm->attr_set(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK, value / 1000);
-
- return count;
+ return therm->attr_set(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK,
+ val / 1000);
}
-static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, nouveau_...
2017 Apr 11
2
[PATCH 1/1] nouveau_hwmon: migrate to hwmon_device_register_with_info
...const char *buf, size_t count)
+
+static int
+nouveau_hwmon_set_max_temp(struct nouveau_drm *drm, long val)
{
- struct drm_device *dev = dev_get_drvdata(d);
- struct nouveau_drm *drm = nouveau_drm(dev);
struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
- long value;
-
- if (kstrtol(buf, 10, &value) == -EINVAL)
- return count;
- therm->attr_set(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK, value / 1000);
-
- return count;
+ therm->attr_set(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK, val / 1000);
+ return val;
}
-static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, nouveau_h...
2017 Apr 26
9
[PATCH v5 0/5] replace hwmon_device_register for hwmon_device_register_with_info
This v5 drops a check for attr_set.
Versions:
v1 -> v2:
* Keep temp attrs as read only
v2 -> v3:
* Code fix-ups: struct and string as const and add return within switch
due to fallthrough
* Add Signed-off-by to all commits
v3 -> v4:
* Rever const to struct attribute. Kbuild complains.
v4 -> v5:
* Drops a check for attr_set in
2017 Apr 12
0
[PATCH 1/1] nouveau_hwmon: migrate to hwmon_device_register_with_info
...set_max_temp(struct nouveau_drm *drm, long val)
> {
> - struct drm_device *dev = dev_get_drvdata(d);
> - struct nouveau_drm *drm = nouveau_drm(dev);
> struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
> - long value;
> -
> - if (kstrtol(buf, 10, &value) == -EINVAL)
> - return count;
>
> - therm->attr_set(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK, value /
1000);
> -
> - return count;
> + therm->attr_set(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK, val / 1000);
> + return val;...
2017 May 08
5
[PATCH v6 0/5] replace hwmon_device_register for hwmon_device_register_with_info
This v6 fixes some comments pointed out by Martin Peres.
Versions:
v1 -> v2:
* Keep temp attrs as read only
v2 -> v3:
* Code fix-ups: struct and string as const and add return within switch
due to fallthrough
* Add Signed-off-by to all commits
v3 -> v4:
* Rever const to struct attribute. Kbuild complains.
v4 -> v5:
* Drops a check for
2017 Apr 22
6
[PATCH v4 0/5] replace hwmon_device_register for hwmon_device_register_with_info
Kbuild sent me an e-mail due to a fixup I introduced in v3.
It complains due to an incompatible pointer type and it doesn't build.
This version reverts it.
Versions:
v1 -> v2:
* Keep temp attrs as read only
v2 -> v3:
* Code fix-ups: struct and string as const and add return within switch
due to fallthrough
* Add Signed-off-by to all commits
v3 -> v4:
2017 Apr 21
6
[PATCH v3 0/5] replace hwmon_device_register for hwmon_device_register_with_info
Hi, this is version v3 with some fix-ups:
Versions:
v1 -> v2:
* Keep temp attrs as read only
v2 -> v3:
* Code fix-ups: struct and string as const and add return within switch
due to fallthrough
* Add Signed-off-by to all commits
This patchseries replaces the deprecated hwmon_device_register function with the
new one hwmon_device_register_with_info.
It also does some cleanup.
Here
2017 May 18
7
[PATCH v8 0/5] replace hwmon_device_register for hwmon_device_register_with_info
This v8 fixes removes dummy functions which only had a return and moves the code
into the switch statements.
Versions:
v1 -> v2:
* Keep temp attrs as read only
v2 -> v3:
* Code fix-ups: struct and string as const and add return within switch
due to fallthrough
* Add Signed-off-by to all commits
v3 -> v4:
* Rever const to struct attribute. Kbuild
2017 May 16
7
[PATCH v7 0/5] replace hwmon_device_register for hwmon_device_register_with_info
This v7 fixes removes dummy functions which only had a return and moves the code
into the switch statements.
Versions:
v1 -> v2:
* Keep temp attrs as read only
v2 -> v3:
* Code fix-ups: struct and string as const and add return within switch
due to fallthrough
* Add Signed-off-by to all commits
v3 -> v4:
* Rever const to struct attribute. Kbuild
2017 Apr 17
9
[PATCH v2 0/5] replace hwmon_device_register for hwmon_device_register_with_info
Hi!
This patchseries replaces the deprecated hwmon_device_register function with the
new one hwmon_device_register_with_info.
It also does some cleanup.
Here is the list of patches and what they do:
1/ Adds config structures for all sensors and their possible settings. This patch
and the next one are just preparing the code for what it comes.
2/ Now everything goes through
2017 Oct 08
1
[RFC PATCH 08/29] clk: We should pass the pstate id around not the index in the list
...vkm_pstate *pstate;
> int ret = 1;
>
> if (clk->allow_reclock && !strncasecmpz(mode, "auto", arglen))
> @@ -528,27 +507,46 @@ nvkm_clk_nstate(struct nvkm_clk *clk, const char *mode, int arglen)
>
> ((char *)mode)[arglen] = '\0';
> if (!kstrtol(mode, 0, &v)) {
> - ret = nvkm_clk_ustate_update(clk, v);
> + ret = v;
> if (ret < 0)
> ret = 1;
> }
> ((char *)mode)[arglen] = save;
> }
>
> - return ret - 2;
> + if (ret < 0)
> + return ret;
Don’t you need to check for `clk->a...
2016 Apr 18
0
[PATCH v4 29/37] clk: we should pass the pstate id around not the index in the list
...return -EINVAL;
- req = i;
- }
-
- return req + 2;
-}
-
-static int
nvkm_clk_nstate(struct nvkm_clk *clk, const char *mode, int arglen)
{
int ret = 1;
@@ -533,23 +512,23 @@ nvkm_clk_nstate(struct nvkm_clk *clk, const char *mode, int arglen)
((char *)mode)[arglen] = '\0';
if (!kstrtol(mode, 0, &v)) {
- ret = nvkm_clk_ustate_update(clk, v);
+ ret = v;
if (ret < 0)
ret = 1;
}
((char *)mode)[arglen] = save;
}
- return ret - 2;
+ return ret;
}
int
nvkm_clk_ustate(struct nvkm_clk *clk, int req, int pwr)
{
- int ret = nvkm_clk_ustate_update(clk, req...
2017 Mar 05
0
[PATCH 5/9] clk: We should pass the pstate id around not the index in the list
...ar *mode, int arglen)
{
+ struct nvkm_pstate *pstate;
int ret = 1;
if (clk->allow_reclock && !strncasecmpz(mode, "auto", arglen))
@@ -528,27 +507,46 @@ nvkm_clk_nstate(struct nvkm_clk *clk, const char *mode, int arglen)
((char *)mode)[arglen] = '\0';
if (!kstrtol(mode, 0, &v)) {
- ret = nvkm_clk_ustate_update(clk, v);
+ ret = v;
if (ret < 0)
ret = 1;
}
((char *)mode)[arglen] = save;
}
- return ret - 2;
+ if (ret < 0)
+ return ret;
+
+ list_for_each_entry(pstate, &clk->states, head) {
+ if (pstate->pstate == ret)...
2017 Sep 15
0
[RFC PATCH 08/29] clk: We should pass the pstate id around not the index in the list
...ar *mode, int arglen)
{
+ struct nvkm_pstate *pstate;
int ret = 1;
if (clk->allow_reclock && !strncasecmpz(mode, "auto", arglen))
@@ -528,27 +507,46 @@ nvkm_clk_nstate(struct nvkm_clk *clk, const char *mode, int arglen)
((char *)mode)[arglen] = '\0';
if (!kstrtol(mode, 0, &v)) {
- ret = nvkm_clk_ustate_update(clk, v);
+ ret = v;
if (ret < 0)
ret = 1;
}
((char *)mode)[arglen] = save;
}
- return ret - 2;
+ if (ret < 0)
+ return ret;
+
+ list_for_each_entry(pstate, &clk->states, head) {
+ if (pstate->pstate == ret)...
2015 Nov 09
5
[PATCH v2 0/5] move pstate interface to debugfs
I made a little changes in this series:
1. merge the two last patches together
2. unify the private data interface with the drm debugfs one
now it should be very obvious for a new dev on how to add new files to debugfs
and how to get access to the nouveau structs
Karol Herbst (5):
debugfs: add infrastructure to add files with other fops than only
read
debugfs: rename functions to
2024 Jan 29
0
[PATCH] [v2] nouveau: add command-line GSP-RM registry support
...;
-
- rpc->entries[i].nameOffset = str_offset;
- rpc->entries[i].type = 1;
- rpc->entries[i].data = r535_registry_entries[i].value;
- rpc->entries[i].length = 4;
- memcpy(strings, r535_registry_entries[i].name, name_len);
- strings += name_len;
- str_offset += name_len;
+ ret = kstrtol(equal + 1, 0, &value);
+ if (ret) {
+ nvkm_error(&gsp->subdev,
+ "ignoring invalid registry value in '%s'\n", start);
+ continue;
+ }
+
+ /* Truncate the key=value string to just key */
+ *equal = 0;
+
+ ret = add_registry_num(gsp, start, value);
+...