Re: [PATCH v11 3/3] dmaengine: ptdma: Add debugfs entries for PTDMA

From: Sanjay R Mehta
Date: Thu Aug 05 2021 - 09:25:46 EST




On 8/5/2021 5:54 PM, Greg KH wrote:
> [CAUTION: External Email]
>
> On Mon, Aug 02, 2021 at 05:32:55AM -0500, Sanjay R Mehta wrote:
>> +void ptdma_debugfs_setup(struct pt_device *pt)
>> +{
>> + struct pt_cmd_queue *cmd_q;
>> + char name[MAX_NAME_LEN + 1];
>> + struct dentry *debugfs_q_instance;
>> +
>> + if (!debugfs_initialized())
>> + return;
>> +
>> + debugfs_create_file("info", 0400, pt->dma_dev.dbg_dev_root, pt,
>> + &pt_debugfs_info_fops);
>> +
>> + debugfs_create_file("stats", 0400, pt->dma_dev.dbg_dev_root, pt,
>> + &pt_debugfs_stats_fops);
>> +
>> + cmd_q = &pt->cmd_q;
>> +
>> + snprintf(name, MAX_NAME_LEN - 1, "q");
>
> You are calling snprintf() to format a string to be "q"? Why? You can
> just do:
>
>> +
>> + debugfs_q_instance =
>> + debugfs_create_dir(name, pt->dma_dev.dbg_dev_root);
>
> debugfs_create_dir("q", pt->....)
>
> here instead.
>

Thanks Greg. Will make this change.

> thanks,
>
> greg k-h
>