Skip to contentSkip to conversation

drm/nouveau/volt: Move assignment outside if condition

PATCH New [email protected] 1 participant 1 message Jul 11, 2023 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 drm/nouveau/volt: Move assignment outside if condition

Fixes the following checkpatch errors:

ERROR: do not use assignment in if condition

---
 drivers/gpu/drm/nouveau/nvkm/subdev/volt/base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/volt/base.c +0 -0
index a17a6dd8d3de..d1ae98a42e34 100644
@@ -321,7 +321,8 @@ int
 nvkm_volt_new_(const struct nvkm_volt_func *func, struct nvkm_device 

*device,
enum nvkm_subdev_type type, int inst, struct nvkm_volt
**pvolt)
{

-    if (!(*pvolt = kzalloc(sizeof(**pvolt), GFP_KERNEL)))
+    *pvolt = kzalloc(sizeof(**pvolt), GFP_KERNEL);
+    if (!*pvolt)
         return -ENOMEM;
     nvkm_volt_ctor(func, device, type, inst, *pvolt);
     return 0;