Re: [PATCH v6] tpm: fix reference counting for struct tpm_chip

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 19.02.21 at 10:13, Jarkko Sakkinen wrote:

>> +	rc = cdev_device_add(&chip->cdevs, &chip->devs);
>> +	if (rc) {
>> +		dev_err(&chip->devs,
>> +			"unable to cdev_device_add() %s, major %d, minor %d, err=%d\n",
>> +			dev_name(&chip->devs), MAJOR(chip->devs.devt),
>> +			MINOR(chip->devs.devt), rc);
>> +		goto out_put_devs;
>> +	}
>> +
>> +	return 0;
>> +
>> +out_put_devs:
>
> A nit:
>
> 1. You have already del_cdev:
> 2. Here you use a differing convention with out prefix.
>
> I'd suggest that you put err_ to both:
>
> 1. err_del_cdev
> 2. err_put_devs
>
> It's quite coherent what we have already:
>
> linux-tpmdd on  next took 8s
> ❯ git grep "^err_.*" drivers/char/tpm/ |  wc -l
> 17
>


The label del_cdev is indeed a bit inconsistent with the rest of the code.
But AFAICS out_put_devs is not:
1. all labels in tpm2-space.c start with out_
2. there are more hits for out_ across the whole TPM code (i.e. with the same command
you used above I get 31 hits for _out) than for err_.

I suggest to rename del_cdev to something like out_del_cdev or maybe out_cdev which
seems to be even closer to the existing naming scheme for labels.


Regards,
Lino






[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux