Message ID | 20240325151150.3368658-1-andriy.shevchenko@linux.intel.com |
---|---|
State | Accepted |
Headers | show |
Series | [v1,1/1] mtd: core: Align comment with an action in mtd_otp_nvmem_add() | expand |
On Mon, Mar 25, 2024 at 05:11:50PM +0200, Andy Shevchenko wrote: > 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.
Hi Andy, andriy.shevchenko@linux.intel.com wrote on Mon, 25 Mar 2024 17:28:12 +0200: > On Mon, Mar 25, 2024 at 05:11:50PM +0200, Andy Shevchenko wrote: > > 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
On Mon, Mar 25 2024, Andy Shevchenko wrote: > 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 <andriy.shevchenko@linux.intel.com> Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
On Mon, 2024-03-25 at 15:11:50 UTC, Andy Shevchenko wrote: > 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 <andriy.shevchenko@linux.intel.com> > Reviewed-by: Pratyush Yadav <pratyush@kernel.org> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks. Miquel
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 9e18422fdc77..d0c231600f84 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -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"); } /**
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 <andriy.shevchenko@linux.intel.com> --- drivers/mtd/mtdcore.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)