[17/19] EDAC, ghes: Remove intermediate buffer pvt->detail_location

Message ID 20191010202418.25098-18-rrichter@marvell.com
State Superseded
Headers show
Series
  • EDAC: Rework edac_mc and ghes drivers
Related show

Commit Message

Robert Richter Oct. 10, 2019, 8:25 p.m.
detail_location[] is used to collect two location strings so they can
be passed as one to trace_mc_event(). Instead of having an extra copy
step, assemble the location string in other_detail[] from the
beginning.

Using other_detail[] to call trace_mc_event() is now the same as in
edac_mc.c and code can be unified.

Reviewed-by: James Morse <james.morse@arm.com>

Signed-off-by: Robert Richter <rrichter@marvell.com>

---
 drivers/edac/ghes_edac.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

-- 
2.20.1

Comments

Mauro Carvalho Chehab Oct. 11, 2019, 11:20 a.m. | #1
Em Thu, 10 Oct 2019 20:25:38 +0000
Robert Richter <rrichter@marvell.com> escreveu:

> detail_location[] is used to collect two location strings so they can

> be passed as one to trace_mc_event(). Instead of having an extra copy

> step, assemble the location string in other_detail[] from the

> beginning.

> 

> Using other_detail[] to call trace_mc_event() is now the same as in

> edac_mc.c and code can be unified.

> 

> Reviewed-by: James Morse <james.morse@arm.com>

> Signed-off-by: Robert Richter <rrichter@marvell.com>


Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


> ---

>  drivers/edac/ghes_edac.c | 9 ++++-----

>  1 file changed, 4 insertions(+), 5 deletions(-)

> 

> diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c

> index 97242cf18a88..8d9d3c4dbebb 100644

> --- a/drivers/edac/ghes_edac.c

> +++ b/drivers/edac/ghes_edac.c

> @@ -21,8 +21,7 @@ struct ghes_edac_pvt {

>  	struct mem_ctl_info *mci;

>  

>  	/* Buffers for the error handling routine */

> -	char detail_location[240];

> -	char other_detail[160];

> +	char other_detail[400];

>  	char msg[80];

>  };

>  

> @@ -356,6 +355,8 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)

>  

>  	/* All other fields are mapped on e->other_detail */

>  	p = pvt->other_detail;

> +	p += snprintf(p, sizeof(pvt->other_detail),

> +		"APEI location: %s ", e->location);

>  	if (mem_err->validation_bits & CPER_MEM_VALID_ERROR_STATUS) {

>  		u64 status = mem_err->error_status;

>  

> @@ -436,12 +437,10 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)

>  	grain_bits = fls_long(e->grain - 1);

>  

>  	/* Generate the trace event */

> -	snprintf(pvt->detail_location, sizeof(pvt->detail_location),

> -		 "APEI location: %s %s", e->location, e->other_detail);

>  	trace_mc_event(e->type, e->msg, e->label, e->error_count,

>  		       mci->mc_idx, e->top_layer, e->mid_layer, e->low_layer,

>  		       (e->page_frame_number << PAGE_SHIFT) | e->offset_in_page,

> -		       grain_bits, e->syndrome, pvt->detail_location);

> +		       grain_bits, e->syndrome, e->other_detail);

>  

>  	dimm = edac_get_dimm_by_index(mci, e->top_layer);

>  




Thanks,
Mauro

Patch

diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
index 97242cf18a88..8d9d3c4dbebb 100644
--- a/drivers/edac/ghes_edac.c
+++ b/drivers/edac/ghes_edac.c
@@ -21,8 +21,7 @@  struct ghes_edac_pvt {
 	struct mem_ctl_info *mci;
 
 	/* Buffers for the error handling routine */
-	char detail_location[240];
-	char other_detail[160];
+	char other_detail[400];
 	char msg[80];
 };
 
@@ -356,6 +355,8 @@  void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
 
 	/* All other fields are mapped on e->other_detail */
 	p = pvt->other_detail;
+	p += snprintf(p, sizeof(pvt->other_detail),
+		"APEI location: %s ", e->location);
 	if (mem_err->validation_bits & CPER_MEM_VALID_ERROR_STATUS) {
 		u64 status = mem_err->error_status;
 
@@ -436,12 +437,10 @@  void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
 	grain_bits = fls_long(e->grain - 1);
 
 	/* Generate the trace event */
-	snprintf(pvt->detail_location, sizeof(pvt->detail_location),
-		 "APEI location: %s %s", e->location, e->other_detail);
 	trace_mc_event(e->type, e->msg, e->label, e->error_count,
 		       mci->mc_idx, e->top_layer, e->mid_layer, e->low_layer,
 		       (e->page_frame_number << PAGE_SHIFT) | e->offset_in_page,
-		       grain_bits, e->syndrome, pvt->detail_location);
+		       grain_bits, e->syndrome, e->other_detail);
 
 	dimm = edac_get_dimm_by_index(mci, e->top_layer);