Commit e75880dd authored by Marek Vasut's avatar Marek Vasut Committed by Herbert Xu

crypto: caam - Kill the easy targets

Fix the functions which can be obviously done right with a simple
dev_err() now. While at it, further press the on-stack allocation
of buffer for sprintf() voodoo down into the abominated functions.

This patch cleans up most of the functions and leaves just two
remaining functions, report_ccb_status() and report_deco_status()
ugly and unhappy.
Signed-off-by: default avatarMarek Vasut <marex@denx.de>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Horia Geanta <horia.geanta@freescale.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 8a475826
...@@ -182,8 +182,10 @@ static void report_jump_idx(u32 status, char *outstr) ...@@ -182,8 +182,10 @@ static void report_jump_idx(u32 status, char *outstr)
} }
static void report_ccb_status(struct device *jrdev, u32 status, static void report_ccb_status(struct device *jrdev, u32 status,
const char *error, char *outstr) const char *error, char *__outstr)
{ {
char outstr[CAAM_ERROR_STR_MAX];
u8 cha_id = (status & JRSTA_CCBERR_CHAID_MASK) >> u8 cha_id = (status & JRSTA_CCBERR_CHAID_MASK) >>
JRSTA_CCBERR_CHAID_SHIFT; JRSTA_CCBERR_CHAID_SHIFT;
u8 err_id = status & JRSTA_CCBERR_ERRID_MASK; u8 err_id = status & JRSTA_CCBERR_ERRID_MASK;
...@@ -213,18 +215,22 @@ static void report_ccb_status(struct device *jrdev, u32 status, ...@@ -213,18 +215,22 @@ static void report_ccb_status(struct device *jrdev, u32 status,
SPRINTFCAT(outstr, "unidentified err_id value 0x%02x", SPRINTFCAT(outstr, "unidentified err_id value 0x%02x",
err_id, sizeof("ff")); err_id, sizeof("ff"));
} }
dev_err(jrdev, "%08x: %s\n", status, outstr);
} }
static void report_jump_status(struct device *jrdev, u32 status, static void report_jump_status(struct device *jrdev, u32 status,
const char *error, char *outstr) const char *error, char *outstr)
{ {
sprintf(outstr, "%s: ", error); dev_err(jrdev, "%08x: %s: %s() not implemented\n",
SPRINTFCAT(outstr, "%s() not implemented", __func__, sizeof(__func__)); status, error, __func__);
} }
static void report_deco_status(struct device *jrdev, u32 status, static void report_deco_status(struct device *jrdev, u32 status,
const char *error, char *outstr) const char *error, char *__outstr)
{ {
char outstr[CAAM_ERROR_STR_MAX];
u8 desc_error = status & JRSTA_DECOERR_ERROR_MASK; u8 desc_error = status & JRSTA_DECOERR_ERROR_MASK;
int i; int i;
sprintf(outstr, "%s: ", error); sprintf(outstr, "%s: ", error);
...@@ -242,25 +248,26 @@ static void report_deco_status(struct device *jrdev, u32 status, ...@@ -242,25 +248,26 @@ static void report_deco_status(struct device *jrdev, u32 status,
SPRINTFCAT(outstr, "unidentified error value 0x%02x", SPRINTFCAT(outstr, "unidentified error value 0x%02x",
desc_error, sizeof("ff")); desc_error, sizeof("ff"));
} }
dev_err(jrdev, "%08x: %s\n", status, outstr);
} }
static void report_jr_status(struct device *jrdev, u32 status, static void report_jr_status(struct device *jrdev, u32 status,
const char *error, char *outstr) const char *error, char *outstr)
{ {
sprintf(outstr, "%s: ", error); dev_err(jrdev, "%08x: %s: %s() not implemented\n",
SPRINTFCAT(outstr, "%s() not implemented", __func__, sizeof(__func__)); status, error, __func__);
} }
static void report_cond_code_status(struct device *jrdev, u32 status, static void report_cond_code_status(struct device *jrdev, u32 status,
const char *error, char *outstr) const char *error, char *outstr)
{ {
sprintf(outstr, "%s: ", error); dev_err(jrdev, "%08x: %s: %s() not implemented\n",
SPRINTFCAT(outstr, "%s() not implemented", __func__, sizeof(__func__)); status, error, __func__);
} }
void caam_jr_strstatus(struct device *jrdev, u32 status) void caam_jr_strstatus(struct device *jrdev, u32 status)
{ {
char outstr[CAAM_ERROR_STR_MAX];
static const struct stat_src { static const struct stat_src {
void (*report_ssed)(struct device *jrdev, u32 status, void (*report_ssed)(struct device *jrdev, u32 status,
const char *error, char *outstr); const char *error, char *outstr);
...@@ -287,8 +294,6 @@ void caam_jr_strstatus(struct device *jrdev, u32 status) ...@@ -287,8 +294,6 @@ void caam_jr_strstatus(struct device *jrdev, u32 status)
} }
status_src[ssrc].report_ssed(jrdev, status, status_src[ssrc].report_ssed(jrdev, status,
status_src[ssrc].error, outstr); status_src[ssrc].error, NULL);
dev_err(jrdev, "%08x: %s\n", status, outstr);
} }
EXPORT_SYMBOL(caam_jr_strstatus); EXPORT_SYMBOL(caam_jr_strstatus);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment