diff mbox

[6/6] staging: sm750fb: correct integer comparison

Message ID 1426007817-1884-7-git-send-email-sudipm.mukherjee@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sudip Mukherjee March 10, 2015, 5:16 p.m. UTC
fixed the build warning about comparison of pointer and integer.
end of string was being compared to NULL.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/staging/sm750fb/sm750.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dan Carpenter March 11, 2015, 7:57 a.m. UTC | #1
On Tue, Mar 10, 2015 at 10:46:57PM +0530, Sudip Mukherjee wrote:
> fixed the build warning about comparison of pointer and integer.
> end of string was being compared to NULL.
> 
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
>  drivers/staging/sm750fb/sm750.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
> index 021b863..5532a28 100644
> --- a/drivers/staging/sm750fb/sm750.c
> +++ b/drivers/staging/sm750fb/sm750.c
> @@ -1000,7 +1000,7 @@ static void sm750fb_setup(struct lynx_share * share,char * src)
>              goto NO_PARAM;
>          }
>  
> -        while((opt = strsep(&src,":")) != NULL && *opt != NULL){
> +        while((opt = strsep(&src,":")) != NULL && *opt != 0){

Use '\0' for the NUL char.

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sudip Mukherjee March 11, 2015, 8:55 a.m. UTC | #2
On Wed, Mar 11, 2015 at 10:57:43AM +0300, Dan Carpenter wrote:
> On Tue, Mar 10, 2015 at 10:46:57PM +0530, Sudip Mukherjee wrote:
> >  
> > -        while((opt = strsep(&src,":")) != NULL && *opt != NULL){
> > +        while((opt = strsep(&src,":")) != NULL && *opt != 0){
> 
> Use '\0' for the NUL char.
i got a doubt while making that patch, so i checked lib/string.c and
saw both 0 and '\0' are used.

regards
sudip
> 
> regards,
> dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 021b863..5532a28 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1000,7 +1000,7 @@  static void sm750fb_setup(struct lynx_share * share,char * src)
             goto NO_PARAM;
         }
 
-        while((opt = strsep(&src,":")) != NULL && *opt != NULL){
+        while((opt = strsep(&src,":")) != NULL && *opt != 0){
 			pr_err("opt=%s\n",opt);
 			pr_err("src=%s\n",src);