aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2014-04-24 14:05:16 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2014-05-08 09:58:08 -0400
commite75880dd9afb60ff59efe079ac50ccc16daffe54 (patch)
tree2a599fa4ff707e5e848028a04f899b9522be7d4d
parent8a4758268292eb036a63f49746fbfe3fcdc0c51d (diff)
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: Marek Vasut <marex@denx.de> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Horia Geanta <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/crypto/caam/error.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/crypto/caam/error.c b/drivers/crypto/caam/error.c
index 7ce1d0349d68..a8736abd717d 100644
--- a/drivers/crypto/caam/error.c
+++ b/drivers/crypto/caam/error.c
@@ -182,8 +182,10 @@ static void report_jump_idx(u32 status, char *outstr)
182} 182}
183 183
184static void report_ccb_status(struct device *jrdev, u32 status, 184static void report_ccb_status(struct device *jrdev, u32 status,
185 const char *error, char *outstr) 185 const char *error, char *__outstr)
186{ 186{
187 char outstr[CAAM_ERROR_STR_MAX];
188
187 u8 cha_id = (status & JRSTA_CCBERR_CHAID_MASK) >> 189 u8 cha_id = (status & JRSTA_CCBERR_CHAID_MASK) >>
188 JRSTA_CCBERR_CHAID_SHIFT; 190 JRSTA_CCBERR_CHAID_SHIFT;
189 u8 err_id = status & JRSTA_CCBERR_ERRID_MASK; 191 u8 err_id = status & JRSTA_CCBERR_ERRID_MASK;
@@ -213,18 +215,22 @@ static void report_ccb_status(struct device *jrdev, u32 status,
213 SPRINTFCAT(outstr, "unidentified err_id value 0x%02x", 215 SPRINTFCAT(outstr, "unidentified err_id value 0x%02x",
214 err_id, sizeof("ff")); 216 err_id, sizeof("ff"));
215 } 217 }
218
219 dev_err(jrdev, "%08x: %s\n", status, outstr);
216} 220}
217 221
218static void report_jump_status(struct device *jrdev, u32 status, 222static void report_jump_status(struct device *jrdev, u32 status,
219 const char *error, char *outstr) 223 const char *error, char *outstr)
220{ 224{
221 sprintf(outstr, "%s: ", error); 225 dev_err(jrdev, "%08x: %s: %s() not implemented\n",
222 SPRINTFCAT(outstr, "%s() not implemented", __func__, sizeof(__func__)); 226 status, error, __func__);
223} 227}
224 228
225static void report_deco_status(struct device *jrdev, u32 status, 229static void report_deco_status(struct device *jrdev, u32 status,
226 const char *error, char *outstr) 230 const char *error, char *__outstr)
227{ 231{
232 char outstr[CAAM_ERROR_STR_MAX];
233
228 u8 desc_error = status & JRSTA_DECOERR_ERROR_MASK; 234 u8 desc_error = status & JRSTA_DECOERR_ERROR_MASK;
229 int i; 235 int i;
230 sprintf(outstr, "%s: ", error); 236 sprintf(outstr, "%s: ", error);
@@ -242,25 +248,26 @@ static void report_deco_status(struct device *jrdev, u32 status,
242 SPRINTFCAT(outstr, "unidentified error value 0x%02x", 248 SPRINTFCAT(outstr, "unidentified error value 0x%02x",
243 desc_error, sizeof("ff")); 249 desc_error, sizeof("ff"));
244 } 250 }
251
252 dev_err(jrdev, "%08x: %s\n", status, outstr);
245} 253}
246 254
247static void report_jr_status(struct device *jrdev, u32 status, 255static void report_jr_status(struct device *jrdev, u32 status,
248 const char *error, char *outstr) 256 const char *error, char *outstr)
249{ 257{
250 sprintf(outstr, "%s: ", error); 258 dev_err(jrdev, "%08x: %s: %s() not implemented\n",
251 SPRINTFCAT(outstr, "%s() not implemented", __func__, sizeof(__func__)); 259 status, error, __func__);
252} 260}
253 261
254static void report_cond_code_status(struct device *jrdev, u32 status, 262static void report_cond_code_status(struct device *jrdev, u32 status,
255 const char *error, char *outstr) 263 const char *error, char *outstr)
256{ 264{
257 sprintf(outstr, "%s: ", error); 265 dev_err(jrdev, "%08x: %s: %s() not implemented\n",
258 SPRINTFCAT(outstr, "%s() not implemented", __func__, sizeof(__func__)); 266 status, error, __func__);
259} 267}
260 268
261void caam_jr_strstatus(struct device *jrdev, u32 status) 269void caam_jr_strstatus(struct device *jrdev, u32 status)
262{ 270{
263 char outstr[CAAM_ERROR_STR_MAX];
264 static const struct stat_src { 271 static const struct stat_src {
265 void (*report_ssed)(struct device *jrdev, u32 status, 272 void (*report_ssed)(struct device *jrdev, u32 status,
266 const char *error, char *outstr); 273 const char *error, char *outstr);
@@ -287,8 +294,6 @@ void caam_jr_strstatus(struct device *jrdev, u32 status)
287 } 294 }
288 295
289 status_src[ssrc].report_ssed(jrdev, status, 296 status_src[ssrc].report_ssed(jrdev, status,
290 status_src[ssrc].error, outstr); 297 status_src[ssrc].error, NULL);
291
292 dev_err(jrdev, "%08x: %s\n", status, outstr);
293} 298}
294EXPORT_SYMBOL(caam_jr_strstatus); 299EXPORT_SYMBOL(caam_jr_strstatus);