diff mbox series

libflash: ipmi-hiomap: Document error handling strategy in write path

Message ID 20191128060742.28955-1-andrew@aj.id.au
State Accepted
Headers show
Series libflash: ipmi-hiomap: Document error handling strategy in write path | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (d75e82dbfbb9443efeb3f9a5921ac23605aab469)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Andrew Jeffery Nov. 28, 2019, 6:07 a.m. UTC
Reads explicitly validate window state after the LPC operations have
completed, but this is not necessary in the write path. Explicitly
document the behaviour to make the implicit behaviour clear to future
readers.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 libflash/ipmi-hiomap.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Oliver O'Halloran Dec. 16, 2019, 3:58 a.m. UTC | #1
On Thu, Nov 28, 2019 at 5:06 PM Andrew Jeffery <andrew@aj.id.au> wrote:
>
> Reads explicitly validate window state after the LPC operations have
> completed, but this is not necessary in the write path. Explicitly
> document the behaviour to make the implicit behaviour clear to future
> readers.
>
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>

Thanks for adding that. Merged as 7853fc53cfccc20e7cca0b0bf18c5e84cd5d306c
diff mbox series

Patch

diff --git a/libflash/ipmi-hiomap.c b/libflash/ipmi-hiomap.c
index 7327b83a320c..0328101c69d6 100644
--- a/libflash/ipmi-hiomap.c
+++ b/libflash/ipmi-hiomap.c
@@ -810,6 +810,15 @@  static int ipmi_hiomap_write(struct blocklevel_device *bl, uint64_t pos,
 		if (rc)
 			return rc;
 
+		/*
+		 * Unlike ipmi_hiomap_read() we don't explicitly test if the
+		 * window is still valid after completing the LPC accesses as
+		 * the following hiomap_mark_dirty() will implicitly check for
+		 * us. In the case of a read operation there's no requirement
+		 * that a command that validates window state follows, so the
+		 * read implementation explicitly performs a check.
+		 */
+
 		rc = hiomap_mark_dirty(ctx, pos, size);
 		if (rc)
 			return rc;