Skip to contentSkip to conversation

coresight: tmc: Clean up device specific data

bug report Dan Carpenter 1 participant 1 message Jun 13, 2019 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hello Suzuki K Poulose,

This is a semi-automatic email about new static checker warnings.

The patch 743256e214e8: "coresight: tmc: Clean up device specific data" from May 22, 2019, leads to the following Smatch complaint:

drivers/hwtracing/coresight/coresight-tmc-etr.c:625 tmc_etr_free_flat_buf()
warn: variable dereferenced before check 'flat_buf' (see line 623)

drivers/hwtracing/coresight/coresight-tmc-etr.c
622 struct etr_flat_buf *flat_buf = etr_buf->private;

   623		struct device *real_dev = flat_buf->dev->parent;
                                          ^^^^^^^^^^

The patch introduces a new NULL check

624
625 if (flat_buf && flat_buf->daddr)

                    ^^^^^^^^

but the existing code assumed it can be NULL.

626 dma_free_coherent(real_dev, flat_buf->size,
627 flat_buf->vaddr, flat_buf->daddr);

regards,
dan carpenter