Commit cb3f9730 authored by KOSAKI Motohiro's avatar KOSAKI Motohiro Committed by james toy

Recently, We marked strstrip() as must_check. because it was frequently

misused and it should be checked.  However, we found one exception. 
scsi/ipr.c intentionally ignore return value of strstrip.  Because it
wishes to keep the whitespace at the beginning.

Thus we need to keep with and without checked whitespace trim function. 
This patch adds a new strim() and changes ipr.c to use it.
Suggested-by: default avatarAlan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent a189cd2c
......@@ -1333,7 +1333,7 @@ static void ipr_log_enhanced_dual_ioa_error(struct ipr_ioa_cfg *ioa_cfg,
error = &hostrcb->hcam.u.error.u.type_17_error;
error->failure_reason[sizeof(error->failure_reason) - 1] = '\0';
strstrip(error->failure_reason);
strim(error->failure_reason);
ipr_hcam_err(hostrcb, "%s [PRC: %08X]\n", error->failure_reason,
be32_to_cpu(hostrcb->hcam.u.error.prc));
......@@ -1359,7 +1359,7 @@ static void ipr_log_dual_ioa_error(struct ipr_ioa_cfg *ioa_cfg,
error = &hostrcb->hcam.u.error.u.type_07_error;
error->failure_reason[sizeof(error->failure_reason) - 1] = '\0';
strstrip(error->failure_reason);
strim(error->failure_reason);
ipr_hcam_err(hostrcb, "%s [PRC: %08X]\n", error->failure_reason,
be32_to_cpu(hostrcb->hcam.u.error.prc));
......
......@@ -62,7 +62,14 @@ extern char * strnchr(const char *, size_t, int);
#ifndef __HAVE_ARCH_STRRCHR
extern char * strrchr(const char *,int);
#endif
extern char * __must_check strstrip(char *);
extern char * strim(char *);
static inline __must_check char* strstrip(char *str)
{
return strim(str);
}
#ifndef __HAVE_ARCH_STRSTR
extern char * strstr(const char *,const char *);
#endif
......
......@@ -330,14 +330,14 @@ EXPORT_SYMBOL(strnchr);
#endif
/**
* strstrip - Removes leading and trailing whitespace from @s.
* strim - Removes leading and trailing whitespace from @s.
* @s: The string to be stripped.
*
* Note that the first trailing whitespace is replaced with a %NUL-terminator
* in the given string @s. Returns a pointer to the first non-whitespace
* character in @s.
*/
char *strstrip(char *s)
char *strim(char *s)
{
size_t size;
char *end;
......@@ -357,7 +357,7 @@ char *strstrip(char *s)
return s;
}
EXPORT_SYMBOL(strstrip);
EXPORT_SYMBOL(strim);
#ifndef __HAVE_ARCH_STRLEN
/**
......
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