mbox series

[v2,0/4] crypto: hisilicon/qm - reconstruct and optimize the debugfs code

Message ID 20221105095357.21199-1-yekai13@huawei.com
Headers show
Series crypto: hisilicon/qm - reconstruct and optimize the debugfs code | expand

Message

yekai (A) Nov. 5, 2022, 9:53 a.m. UTC
Split a debugfs.c from qm to reduce the qm code complexity. And optimize the
process of the command dumping. Some optimizations on command dumping in
debugfs.c file code.

changes v1->v2:
	- delete a redundant line.

Kai Ye (4):
  crypto: hisilicon/qm - modify the process of regs dfx
  crypto: hisilicon/qm - split a debugfs.c from qm
  crypto: hisilicon/qm - the command dump process is modified
  crypto: hisilicon/debugfs - delete redundant null assignment
    operations

 drivers/crypto/hisilicon/Makefile         |    2 +-
 drivers/crypto/hisilicon/debugfs.c        | 1172 ++++++++++++++++++
 drivers/crypto/hisilicon/hpre/hpre_main.c |    6 +-
 drivers/crypto/hisilicon/qm.c             | 1360 ++-------------------
 drivers/crypto/hisilicon/qm_common.h      |   87 ++
 drivers/crypto/hisilicon/sec2/sec_main.c  |    6 +-
 drivers/crypto/hisilicon/zip/zip_main.c   |    6 +-
 include/linux/hisi_acc_qm.h               |    8 +-
 8 files changed, 1381 insertions(+), 1266 deletions(-)
 create mode 100644 drivers/crypto/hisilicon/debugfs.c
 create mode 100644 drivers/crypto/hisilicon/qm_common.h

Comments

Herbert Xu Nov. 5, 2022, 10:18 a.m. UTC | #1
On Sat, Nov 05, 2022 at 09:53:54AM +0000, Kai Ye wrote:
>
> +static void dfx_regs_uninit(struct hisi_qm *qm,
> +		struct dfx_diff_registers *dregs, int reg_len)
> +{
> +	int i;
> +
> +	/* Setting the pointer is NULL to prevent double free */
> +	for (i = 0; i < reg_len; i++) {
> +		kfree(dregs[i].regs);
> +		dregs[i].regs = NULL;
> +	}
> +	kfree(dregs);
> +	dregs = NULL;
> +}

The line that I complained about is still here.

Cheers,
yekai (A) Nov. 7, 2022, 6:53 a.m. UTC | #2
On 2022/11/5 18:18, Herbert Xu wrote:
> On Sat, Nov 05, 2022 at 09:53:54AM +0000, Kai Ye wrote:
>> +static void dfx_regs_uninit(struct hisi_qm *qm,
>> +		struct dfx_diff_registers *dregs, int reg_len)
>> +{
>> +	int i;
>> +
>> +	/* Setting the pointer is NULL to prevent double free */
>> +	for (i = 0; i < reg_len; i++) {
>> +		kfree(dregs[i].regs);
>> +		dregs[i].regs = NULL;
>> +	}
>> +	kfree(dregs);
>> +	dregs = NULL;
>> +}
> The line that I complained about is still here.
>
> Cheers,

ok

thanks
kai
Herbert Xu Nov. 7, 2022, 8:47 a.m. UTC | #3
On Mon, Nov 07, 2022 at 02:53:28PM +0800, yekai (A) wrote:
> 
> 
> On 2022/11/5 18:18, Herbert Xu wrote:
> > On Sat, Nov 05, 2022 at 09:53:54AM +0000, Kai Ye wrote:
> >> +static void dfx_regs_uninit(struct hisi_qm *qm,
> >> +		struct dfx_diff_registers *dregs, int reg_len)
> >> +{
> >> +	int i;
> >> +
> >> +	/* Setting the pointer is NULL to prevent double free */
> >> +	for (i = 0; i < reg_len; i++) {
> >> +		kfree(dregs[i].regs);
> >> +		dregs[i].regs = NULL;
> >> +	}
> >> +	kfree(dregs);
> >> +	dregs = NULL;
> >> +}
> > The line that I complained about is still here.
> >
> > Cheers,
> 
> ok

Just to be clear, it's the last line "dregs = NULL" that I was
referring to.  It makes no sense to zero a variable that is on
the stack.

Cheers,
yekai (A) Nov. 7, 2022, 10:46 a.m. UTC | #4
On 2022/11/7 16:47, Herbert Xu wrote:
> On Mon, Nov 07, 2022 at 02:53:28PM +0800, yekai (A) wrote:
>>
>> On 2022/11/5 18:18, Herbert Xu wrote:
>>> On Sat, Nov 05, 2022 at 09:53:54AM +0000, Kai Ye wrote:
>>>> +static void dfx_regs_uninit(struct hisi_qm *qm,
>>>> +		struct dfx_diff_registers *dregs, int reg_len)
>>>> +{
>>>> +	int i;
>>>> +
>>>> +	/* Setting the pointer is NULL to prevent double free */
>>>> +	for (i = 0; i < reg_len; i++) {
>>>> +		kfree(dregs[i].regs);
>>>> +		dregs[i].regs = NULL;
>>>> +	}
>>>> +	kfree(dregs);
>>>> +	dregs = NULL;
>>>> +}
>>> The line that I complained about is still here.
>>>
>>> Cheers,
>> ok
> Just to be clear, it's the last line "dregs = NULL" that I was
> referring to.  It makes no sense to zero a variable that is on
> the stack.
>
> Cheers,

I got it. I will fix it and resend the patch set in the next version.

Thanks
Kai