On Sun, Feb 21, 2021 at 11:19:28AM +0100, Lino Sanfilippo wrote:
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:
- You have already del_cdev:
- Here you use a differing convention with out prefix.
I'd suggest that you put err_ to both:
- err_del_cdev
- 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:
- all labels in tpm2-space.c start with out_
- 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.
Generally, I'd prefer the following pattern:
out: /* out for success path if needed */
return 0;
err_foo:
err_bar:
return ret;
Existing naming scheme is not something to hang into, and I don't care to preserve it.
Regards, Lino
/Jarkko