nvc0/ir: Initialize CodeEmitterGK110 member progType in constructor.
authorVinson Lee <vlee@freedesktop.org>
Sun, 9 May 2021 00:23:52 +0000 (17:23 -0700)
committerVinson Lee <vlee@freedesktop.org>
Thu, 13 May 2021 05:18:30 +0000 (22:18 -0700)
Fix defect reported by Coverity Scan.

Uninitialized scalar field (UNINIT_CTOR)
uninit_member: Non-static class member progType is not initialized in
this constructor nor in any functions that it calls.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10715>

src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp

index 02d0e3d..46354a2 100644 (file)
@@ -29,14 +29,12 @@ namespace nv50_ir {
 class CodeEmitterGK110 : public CodeEmitter
 {
 public:
-   CodeEmitterGK110(const TargetNVC0 *);
+   CodeEmitterGK110(const TargetNVC0 *, Program::Type);
 
    virtual bool emitInstruction(Instruction *);
    virtual uint32_t getMinEncodingSize(const Instruction *) const;
    virtual void prepareEmission(Function *);
 
-   inline void setProgramType(Program::Type pType) { progType = pType; }
-
 private:
    const TargetNVC0 *targNVC0;
 
@@ -2793,9 +2791,10 @@ CodeEmitterGK110::prepareEmission(Function *func)
       calculateSchedDataNVC0(targ, func);
 }
 
-CodeEmitterGK110::CodeEmitterGK110(const TargetNVC0 *target)
+CodeEmitterGK110::CodeEmitterGK110(const TargetNVC0 *target, Program::Type type)
    : CodeEmitter(target),
      targNVC0(target),
+     progType(type),
      writeIssueDelays(target->hasSWSched)
 {
    code = NULL;
@@ -2806,8 +2805,7 @@ CodeEmitterGK110::CodeEmitterGK110(const TargetNVC0 *target)
 CodeEmitter *
 TargetNVC0::createCodeEmitterGK110(Program::Type type)
 {
-   CodeEmitterGK110 *emit = new CodeEmitterGK110(this);
-   emit->setProgramType(type);
+   CodeEmitterGK110 *emit = new CodeEmitterGK110(this, type);
    return emit;
 }