mtd: core: Align comment with an action in mtd_otp_nvmem_add()
PATCH 1/1 mtd: core: Align comment with an action in mtd_otp_nvmem_add()
The comment is related to the non-error case, make it more clear by inverting the condition. It also makes code neater at the end.
--- drivers/mtd/mtdcore.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/mtd/mtdcore.c +3 -4
@@ -1015,10 +1015,9 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd) err:nvmem_unregister (mtd->otp_user_nvmem);/* Don't report error if OTP is not supported. */ -if (err != -EOPNOTSUPP ) -return dev_err_probe (dev, err, -"Failed to register OTP NVMEM device\n" ); -return 0 ; +if (err == -EOPNOTSUPP ) +return 0 ; +return dev_err_probe (dev, err,"Failed to register OTP NVMEM device\n" ); }/**
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
Quoted 2 lines · Andy Shevchenko
The comment is related to the non-error case, make it more clear by inverting the condition. It also makes code neater at the end.
Just realized that even semantically it's better as it's done here since we have an error path from which we exceptionally return successes (in some cases). Tell me if I need to add this to the commit message.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Miquel Raynal
maintainerHi Andy,
[email protected] wrote on Mon, 25 Mar 2024 17:28:12 +0200:
Quoted 8 lines · Andy Shevchenko
Quoted 2 lines
The comment is related to the non-error case, make it more clear by inverting the condition. It also makes code neater at the end.
Just realized that even semantically it's better as it's done here since we have an error path from which we exceptionally return successes (in some cases). Tell me if I need to add this to the commit message.
It's fine like that.
Thanks,
Miquèl
Quoted 4 lines · Andy Shevchenko
The comment is related to the non-error case, make it more clear by inverting the condition. It also makes code neater at the end.
Signed-off-by Andy Shevchenko <[email protected]>
Signature · 2 lines
Regards, Pratyush Yadav
Quoted 5 lines · Andy Shevchenko
The comment is related to the non-error case, make it more clear by inverting the condition. It also makes code neater at the end.
Signed-off-by Andy Shevchenko <[email protected]>Reviewed-by Pratyush Yadav <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.
Miquel