coresight: tmc: Delete an unnecessary check before the function call "kfree"
[cascardo/linux.git] / drivers / hwtracing / coresight / coresight-tmc-etf.c
index 466af86..5fa49c4 100644 (file)
@@ -48,6 +48,7 @@ static void tmc_etb_dump_hw(struct tmc_drvdata *drvdata)
        int i;
 
        bufp = drvdata->buf;
+       drvdata->len = 0;
        while (1) {
                for (i = 0; i < drvdata->memwidth; i++) {
                        read_data = readl_relaxed(drvdata->base + TMC_RRD);
@@ -55,6 +56,7 @@ static void tmc_etb_dump_hw(struct tmc_drvdata *drvdata)
                                return;
                        memcpy(bufp, &read_data, 4);
                        bufp += 4;
+                       drvdata->len += 4;
                }
        }
 }
@@ -166,7 +168,7 @@ out:
        spin_unlock_irqrestore(&drvdata->spinlock, flags);
 
        /* Free memory outside the spinlock if need be */
-       if (!used && buf)
+       if (!used)
                kfree(buf);
 
        if (!ret)