Skip to contentSkip to conversation

staging: sm750fb: Avoid multiple assignments

PATCH In review Nishka Dasgupta 4 participants 7 messages Mar 4, 2019 – Mar 5, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: sm750fb: Avoid multiple assignments

Avoid multiple assignments in the same line. Issue found with Checkpatch.

---
 drivers/staging/sm750fb/sm750.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/sm750fb/sm750.c +2 -1
index e9f10c2669ea..739841c3b5d6 100644
@@ -782,7 +782,8 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
 		0x800f0 + (int)crtc->channel * 0x140;
 
 	pr_info("crtc->cursor.mmio = %p\n", crtc->cursor.mmio);
-	crtc->cursor.maxH = crtc->cursor.maxW = 64;
+	crtc->cursor.maxW = 64;
+	crtc->cursor.maxH = crtc->cursor.maxW;
 	crtc->cursor.size = crtc->cursor.maxH * crtc->cursor.maxW * 2 / 8;
 	crtc->cursor.vstart = sm750_dev->pvMem + crtc->cursor.offset;
 
Signature · 1 line
2.19.1
#1 lore raw

On Tue, 5 Mar 2019, 'Nishka Dasgupta' via outreachy-kernel wrote:

Something is going wrong in how you are sending your mail. This message was put in the group's spam folder. Maybe you are subscribed with a different address?

julia

Quoted 13 lines

Avoid multiple assignments in the same line. Issue found with Checkpatch.

---
 drivers/staging/sm750fb/sm750.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/sm750fb/sm750.c +0 -0
index e9f10c2669ea..739841c3b5d6 100644

drivers/staging/sm750fb/sm750.c static int lynxfb_set_fbinfo(struct fb_info *info, int index) · line 786

Quoted 6 lines
drivers/staging/sm750fb/sm750.c +2 -1
@@ -782,7 +782,8 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
 		0x800f0 + (int)crtc->channel * 0x140;
 
 	pr_info("crtc->cursor.mmio = %p\n", crtc->cursor.mmio);
-	crtc->cursor.maxH = crtc->cursor.maxW = 64;
+	crtc->cursor.maxW = 64;
+	crtc->cursor.maxH = crtc->cursor.maxW;

Maybe it would be simpler to say = 64 both times?

julia

Quoted 13 lines
drivers/staging/sm750fb/sm750.c +0 -1
 	crtc->cursor.size = crtc->cursor.maxH * crtc->cursor.maxW * 2 / 8;
 	crtc->cursor.vstart = sm750_dev->pvMem + crtc->cursor.offset;
 
--

2.19.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190304183110.3702-1-nishka.dasgupta%40yahoo.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 9 lines · Julia Lawall

On Tue, 5 Mar 2019, 'Nishka Dasgupta' via outreachy-kernel wrote:

Something is going wrong in how you are sending your mail. This message was put in the group's spam folder. Maybe you are subscribed with a different address?

Yes, I am subscribed with [email protected] but I am sending patches from [email protected]. I tried to join the kernel google group with my Yahoo address but it wouldn't let me; what should I do?

Quoted 19 lines

julia

Quoted 15 lines

Avoid multiple assignments in the same line. Issue found with Checkpatch.

---
 drivers/staging/sm750fb/sm750.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/sm750fb/sm750.c +0 -0
index e9f10c2669ea..739841c3b5d6 100644
@@ -782,7 +782,8 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
              0x800f0 + (int)crtc->channel * 0x140;
 
Quoted 6 lines

drivers/staging/sm750fb/sm750.c static int lynxfb_set_fbinfo(struct fb_info *info, int index) · line 786

Quoted 4 lines
drivers/staging/sm750fb/sm750.c +2 -1
      pr_info("crtc->cursor.mmio = %p\n", crtc->cursor.mmio);
-     crtc->cursor.maxH = crtc->cursor.maxW = 64;
+     crtc->cursor.maxW = 64;
+     crtc->cursor.maxH = crtc->cursor.maxW;

Maybe it would be simpler to say = 64 both times?

Yes, it would, but I wasn't sure if it was important for maxH and maxW to always have the same value; if so, then setting one to 64 and the other to always have the same value as the first seemed safer. If they don't have to be the same, I can change accordingly.

Quoted 16 lines

julia

Quoted 6 lines
drivers/staging/sm750fb/sm750.c +0 -1
      crtc->cursor.size = crtc->cursor.maxH * crtc->cursor.maxW * 2 / 8;
      crtc->cursor.vstart = sm750_dev->pvMem + crtc->cursor.offset;
 
--

2.19.1

Quoted 7 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190304183110.3702-1-nishka.dasgupta%40yahoo.com.
For more options, visit https://groups.google.com/d/optout.

Quoted 6 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.21.1903042153230.2591%40hadrien.
For more options, visit https://groups.google.com/d/optout.

- Nishka

maintainer
#3 lore raw
In reply to Nishka Dasgupta
Quoted 13 lines · Nishka Dasgupta

Avoid multiple assignments in the same line. Issue found with Checkpatch.

---
 drivers/staging/sm750fb/sm750.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/sm750fb/sm750.c +0 -0
index e9f10c2669ea..739841c3b5d6 100644

drivers/staging/sm750fb/sm750.c static int lynxfb_set_fbinfo(struct fb_info *info, int index) · line 786

Quoted 6 lines
drivers/staging/sm750fb/sm750.c +2 -1
@@ -782,7 +782,8 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
 		0x800f0 + (int)crtc->channel * 0x140;
 
 	pr_info("crtc->cursor.mmio = %p\n", crtc->cursor.mmio);
-	crtc->cursor.maxH = crtc->cursor.maxW = 64;
+	crtc->cursor.maxW = 64;
+	crtc->cursor.maxH = crtc->cursor.maxW;

The original code is fine here. I would just ignore this checkpatch.pl message for this line.

thanks,

greg k-h

#4 lore raw
Quoted 16 lines · Greg KH
Quoted 15 lines · Nishka Dasgupta

Avoid multiple assignments in the same line. Issue found with Checkpatch.

---
  drivers/staging/sm750fb/sm750.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/sm750fb/sm750.c +0 -0
index e9f10c2669ea..739841c3b5d6 100644
@@ -782,7 +782,8 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
  		0x800f0 + (int)crtc->channel * 0x140;
 
Quoted 7 lines

drivers/staging/sm750fb/sm750.c static int lynxfb_set_fbinfo(struct fb_info *info, int index) · line 786

Quoted 4 lines
drivers/staging/sm750fb/sm750.c +2 -1
  	pr_info("crtc->cursor.mmio = %p\n", crtc->cursor.mmio);
-	crtc->cursor.maxH = crtc->cursor.maxW = 64;
+	crtc->cursor.maxW = 64;
+	crtc->cursor.maxH = crtc->cursor.maxW;

The original code is fine here. I would just ignore this checkpatch.pl message for this line.

Okay, will do. What should I do for similar Checkpatch warnings in future? Do I just ignore them?

Quoted 4 lines

thanks,

greg k-h

maintainer
#5 lore raw
Quoted 25 lines · Nishka Dasgupta
Quoted 9 lines · Greg KH
Quoted 8 lines · Nishka Dasgupta

Avoid multiple assignments in the same line. Issue found with Checkpatch.

---
  drivers/staging/sm750fb/sm750.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 13 lines

drivers/staging/sm750fb/sm750.c static int lynxfb_set_fbinfo(struct fb_info *info, int index) · line 785

Quoted 10 lines
drivers/staging/sm750fb/sm750.c +2 -1
index e9f10c2669ea..739841c3b5d6 100644
@@ -782,7 +782,8 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
  		0x800f0 + (int)crtc->channel * 0x140;
  	pr_info("crtc->cursor.mmio = %p\n", crtc->cursor.mmio);
-	crtc->cursor.maxH = crtc->cursor.maxW = 64;
+	crtc->cursor.maxW = 64;
+	crtc->cursor.maxH = crtc->cursor.maxW;

The original code is fine here. I would just ignore this checkpatch.pl message for this line.

Quoted 2 lines

Okay, will do. What should I do for similar Checkpatch warnings in future? Do I just ignore them?

It all depends on what they look like. This one is setting a width and height to the exact same value, making it pretty obvious what is going on here. If other code is doing other things (like just zeroing out stuff, or using temp variables), maybe it should be fixed up.

Again, checkpatch is just a hint, you still need to use your brain to see if what it says makes sense :)

thanks,

greg k-h

#6 lore raw
Quoted 29 lines · Greg KH
Quoted 25 lines · Nishka Dasgupta
Quoted 9 lines · Greg KH
Quoted 8 lines · Nishka Dasgupta

Avoid multiple assignments in the same line. Issue found with Checkpatch.

---
   drivers/staging/sm750fb/sm750.c | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 13 lines

drivers/staging/sm750fb/sm750.c static int lynxfb_set_fbinfo(struct fb_info *info, int index) · line 785

Quoted 10 lines
drivers/staging/sm750fb/sm750.c +2 -1
index e9f10c2669ea..739841c3b5d6 100644
@@ -782,7 +782,8 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
   		0x800f0 + (int)crtc->channel * 0x140;
   	pr_info("crtc->cursor.mmio = %p\n", crtc->cursor.mmio);
-	crtc->cursor.maxH = crtc->cursor.maxW = 64;
+	crtc->cursor.maxW = 64;
+	crtc->cursor.maxH = crtc->cursor.maxW;

The original code is fine here. I would just ignore this checkpatch.pl message for this line.

Quoted 2 lines

Okay, will do. What should I do for similar Checkpatch warnings in future? Do I just ignore them?

Quoted 7 lines

It all depends on what they look like. This one is setting a width and height to the exact same value, making it pretty obvious what is going on here. If other code is doing other things (like just zeroing out stuff, or using temp variables), maybe it should be fixed up.

Again, checkpatch is just a hint, you still need to use your brain to see if what it says makes sense :)

Yes, of course. I'll take it on a case-by-case basis then, as you've suggested. Thank you!
-Nishka

Quoted 4 lines

thanks,

greg k-h