linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] mtd: core: Align comment with an action in mtd_otp_nvmem_add()
@ 2024-03-25 15:11 Andy Shevchenko
  2024-03-25 15:28 ` Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andy Shevchenko @ 2024-03-25 15:11 UTC (permalink / raw)
  To: linux-mtd, linux-kernel
  Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	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 <andriy.shevchenko@linux.intel.com>
---
 drivers/mtd/mtdcore.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

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");
 }
 
 /**
-- 
2.43.0.rc1.1.gbec44491f096


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] mtd: core: Align comment with an action in mtd_otp_nvmem_add()
  2024-03-25 15:11 [PATCH v1 1/1] mtd: core: Align comment with an action in mtd_otp_nvmem_add() Andy Shevchenko
@ 2024-03-25 15:28 ` Andy Shevchenko
  2024-03-25 15:49   ` Miquel Raynal
  2024-03-25 16:22 ` Pratyush Yadav
  2024-04-09  6:40 ` Miquel Raynal
  2 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2024-03-25 15:28 UTC (permalink / raw)
  To: linux-mtd, linux-kernel
  Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra

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.

-- 
With Best Regards,
Andy Shevchenko



______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] mtd: core: Align comment with an action in mtd_otp_nvmem_add()
  2024-03-25 15:28 ` Andy Shevchenko
@ 2024-03-25 15:49   ` Miquel Raynal
  0 siblings, 0 replies; 5+ messages in thread
From: Miquel Raynal @ 2024-03-25 15:49 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-mtd, linux-kernel, Richard Weinberger, Vignesh Raghavendra

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

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] mtd: core: Align comment with an action in mtd_otp_nvmem_add()
  2024-03-25 15:11 [PATCH v1 1/1] mtd: core: Align comment with an action in mtd_otp_nvmem_add() Andy Shevchenko
  2024-03-25 15:28 ` Andy Shevchenko
@ 2024-03-25 16:22 ` Pratyush Yadav
  2024-04-09  6:40 ` Miquel Raynal
  2 siblings, 0 replies; 5+ messages in thread
From: Pratyush Yadav @ 2024-03-25 16:22 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-mtd, linux-kernel, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra

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>

-- 
Regards,
Pratyush Yadav

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] mtd: core: Align comment with an action in mtd_otp_nvmem_add()
  2024-03-25 15:11 [PATCH v1 1/1] mtd: core: Align comment with an action in mtd_otp_nvmem_add() Andy Shevchenko
  2024-03-25 15:28 ` Andy Shevchenko
  2024-03-25 16:22 ` Pratyush Yadav
@ 2024-04-09  6:40 ` Miquel Raynal
  2 siblings, 0 replies; 5+ messages in thread
From: Miquel Raynal @ 2024-04-09  6:40 UTC (permalink / raw)
  To: Andy Shevchenko, linux-mtd, linux-kernel
  Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra

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

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-09  6:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-25 15:11 [PATCH v1 1/1] mtd: core: Align comment with an action in mtd_otp_nvmem_add() Andy Shevchenko
2024-03-25 15:28 ` Andy Shevchenko
2024-03-25 15:49   ` Miquel Raynal
2024-03-25 16:22 ` Pratyush Yadav
2024-04-09  6:40 ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).