drm/nouveau/nvkm: adjust memory check and use in proper order
Subsystems (3)
PATCH 1/1 drm/nouveau/nvkm: adjust memory check and use in proper order
Signed-off-by Weiguo Li <[email protected]>
--- drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/therm/fanpwm.c | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/therm/fantog.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c +1 -1
@@ -416,9 +416,9 @@ nvkm_pstate_new(struct nvkm_clk *clk, int idx)return 0 ; pstate =kzalloc (sizeof (*pstate),GFP_KERNEL ); - cstate = &pstate->base;if (!pstate)return -ENOMEM ; + cstate = &pstate->base;INIT_LIST_HEAD (&pstate->list);
drivers/gpu/drm/nouveau/nvkm/subdev/therm/fanpwm.c +1 -1
@@ -98,9 +98,9 @@ nvkm_fanpwm_create(struct nvkm_therm *therm, struct dcb_gpio_func *func)return -ENODEV ; fan =kzalloc (sizeof (*fan),GFP_KERNEL ); - therm->fan = &fan->base;if (!fan)return -ENOMEM ; + therm->fan = &fan->base; fan->base.type ="PWM" ; fan->base.get = nvkm_fanpwm_get;
drivers/gpu/drm/nouveau/nvkm/subdev/therm/fantog.c +1 -1
@@ -100,9 +100,9 @@ nvkm_fantog_create(struct nvkm_therm *therm, struct dcb_gpio_func *func) } fan =kzalloc (sizeof (*fan),GFP_KERNEL ); - therm->fan = &fan->base;if (!fan)return -ENOMEM ; + therm->fan = &fan->base; fan->base.type ="toggle" ; fan->base.get = nvkm_fantog_get;
Signature · 1 line
2.25.1
PATCH v2 1/1 drm/nouveau/nvkm: fix dereference before null check
Move pointer dereference after null check.
Signed-off-by Weiguo Li <[email protected]>
---
v2:
* update commit log
--- drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/therm/fanpwm.c | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/therm/fantog.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c +1 -1
@@ -416,9 +416,9 @@ nvkm_pstate_new(struct nvkm_clk *clk, int idx)return 0 ; pstate =kzalloc (sizeof (*pstate),GFP_KERNEL ); - cstate = &pstate->base;if (!pstate)return -ENOMEM ; + cstate = &pstate->base;INIT_LIST_HEAD (&pstate->list);
drivers/gpu/drm/nouveau/nvkm/subdev/therm/fanpwm.c +1 -1
@@ -98,9 +98,9 @@ nvkm_fanpwm_create(struct nvkm_therm *therm, struct dcb_gpio_func *func)return -ENODEV ; fan =kzalloc (sizeof (*fan),GFP_KERNEL ); - therm->fan = &fan->base;if (!fan)return -ENOMEM ; + therm->fan = &fan->base; fan->base.type ="PWM" ; fan->base.get = nvkm_fanpwm_get;
drivers/gpu/drm/nouveau/nvkm/subdev/therm/fantog.c +1 -1
@@ -100,9 +100,9 @@ nvkm_fantog_create(struct nvkm_therm *therm, struct dcb_gpio_func *func) } fan =kzalloc (sizeof (*fan),GFP_KERNEL ); - therm->fan = &fan->base;if (!fan)return -ENOMEM ; + therm->fan = &fan->base; fan->base.type ="toggle" ; fan->base.get = nvkm_fantog_get;
Signature · 1 line
2.25.1