Skip to contentSkip to conversation

coresight: etm: Clean up device specific data

bug report Dan Carpenter 2 participants 3 messages 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 21d26b905c05: "coresight: etm: Clean up device specific data" from May 22, 2019, leads to the following Smatch complaint:

./drivers/hwtracing/coresight/coresight-etm3x.c:460 etm_get_trace_id()
warn: variable dereferenced before check 'drvdata' (see line 458)

./drivers/hwtracing/coresight/coresight-etm3x.c
457 int trace_id = -1;

   458		struct device *etm_dev = drvdata->csdev->dev.parent;
                                         ^^^^^^^^^

New dereference

459
460 if (!drvdata)

                    ^^^^^^^^

Checked too late. Delete the check?

461 goto out;
462

regards,
dan carpenter

#1 lore raw

Hi Dan

Quoted 16 lines · Dan Carpenter

Hello Suzuki K Poulose,

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

The patch 21d26b905c05: "coresight: etm: Clean up device specific data" from May 22, 2019, leads to the following Smatch complaint:

./drivers/hwtracing/coresight/coresight-etm3x.c:460 etm_get_trace_id()
warn: variable dereferenced before check 'drvdata' (see line 458)

./drivers/hwtracing/coresight/coresight-etm3x.c

    457		int trace_id = -1;
    458		struct device *etm_dev = drvdata->csdev->dev.parent;
                                          ^^^^^^^^^

New dereference

Quoted 8 lines
    459	
    460		if (!drvdata)
                     ^^^^^^^^

Checked too late. Delete the check?

    461			goto out;
    462	

Thanks for the report. I have sent a patch to fix it.

Cheers
Suzuki