Skip to contentSkip to conversation

staging: sm750fb: fixing function return with lock held

PATCH In review Prasant Jalan 2 participants 4 messages Mar 31, 2017 – Apr 3, 2017

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

PATCH 1/2 staging: sm750fb: fixing function return with lock held

lynxfb_suspend() & lynxfb_resume() return on errors while holding console_lock.

Adding 'goto' such that proper cleanups can be done before returning from function and therefore console_lock can be released before returning.

---
 drivers/staging/sm750fb/sm750.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/staging/sm750fb/sm750.c +8 -4
index c618c56..445c68d 100644
@@ -419,7 +419,7 @@ static int lynxfb_suspend(struct pci_dev *pdev, pm_message_t mesg)
 		if (ret) {
 			dev_err(&pdev->dev,
 				"error:%d occurred in pci_save_state\n", ret);
-			return ret;
+			goto lynxfb_suspend_err;
 		}
 
 		ret = pci_set_power_state(pdev, pci_choose_state(pdev, mesg));
@@ -427,11 +427,13 @@ static int lynxfb_suspend(struct pci_dev *pdev, pm_message_t mesg)
 			dev_err(&pdev->dev,
 				"error:%d occurred in pci_set_power_state\n",
 				ret);
-			return ret;
+			goto lynxfb_suspend_err;
 		}
 	}
 
 	pdev->dev.power.power_state = mesg;
+
+lynxfb_suspend_err:
 	console_unlock();
 	return ret;
 }
@@ -456,7 +458,7 @@ static int lynxfb_resume(struct pci_dev *pdev)
 	if (ret) {
 		dev_err(&pdev->dev,
 			"error:%d occurred in pci_set_power_state\n", ret);
-		return ret;
+		goto lynxfb_resume_err;
 	}
 
 	if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) {
@@ -466,7 +468,7 @@ static int lynxfb_resume(struct pci_dev *pdev)
 			dev_err(&pdev->dev,
 				"error:%d occurred in pci_enable_device\n",
 				ret);
-			return ret;
+			goto lynxfb_resume_err;
 		}
 		pci_set_master(pdev);
 	}
@@ -498,6 +500,8 @@ static int lynxfb_resume(struct pci_dev *pdev)
 	}
 
 	pdev->dev.power.power_state.event = PM_EVENT_RESUME;
+
+lynxfb_resume_err:
 	console_unlock();
 	return ret;
 }
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 staging: sm750fb: removed line continuations in quoted strings

checkpatch gives WARNING: Avoid line continuations in quoted strings.

Trivial fix by removing line continuations and adding another quote at the start of next line.

---
 drivers/staging/sm750fb/sm750.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/staging/sm750fb/sm750.c +9 -9
index 445c68d..386d4ad 100644
@@ -837,15 +837,15 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
 
 	/* some member of info->var had been set by fb_find_mode */
 
-	pr_info("Member of info->var is :\n\
-		xres=%d\n\
-		yres=%d\n\
-		xres_virtual=%d\n\
-		yres_virtual=%d\n\
-		xoffset=%d\n\
-		yoffset=%d\n\
-		bits_per_pixel=%d\n \
-		...\n",
+	pr_info("Member of info->var is :\n"
+		"xres=%d\n"
+		"yres=%d\n"
+		"xres_virtual=%d\n"
+		"yres_virtual=%d\n"
+		"xoffset=%d\n"
+		"yoffset=%d\n"
+		"bits_per_pixel=%d\n"
+		" ...\n",
 		var->xres,
 		var->yres,
 		var->xres_virtual,
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 2/2] staging: sm750fb: removed line continuations in quoted strings

Quoted 40 lines · Prasant Jalan

checkpatch gives WARNING: Avoid line continuations in quoted strings.

Trivial fix by removing line continuations and adding another quote at the start of next line.

---
 drivers/staging/sm750fb/sm750.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/staging/sm750fb/sm750.c +9 -10
index 445c68d..386d4ad 100644
@@ -837,15 +837,15 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
 
        /* some member of info->var had been set by fb_find_mode */
 
-       pr_info("Member of info->var is :\n\
-               xres=%d\n\
-               yres=%d\n\
-               xres_virtual=%d\n\
-               yres_virtual=%d\n\
-               xoffset=%d\n\
-               yoffset=%d\n\
-               bits_per_pixel=%d\n \
-               ...\n",
+       pr_info("Member of info->var is :\n"
+               "xres=%d\n"
+               "yres=%d\n"
+               "xres_virtual=%d\n"
+               "yres_virtual=%d\n"
+               "xoffset=%d\n"
+               "yoffset=%d\n"
+               "bits_per_pixel=%d\n"
+               " ...\n",
                var->xres,
                var->yres,
                var->xres_virtual,
--
Quoted 2 lines

2.7.4

Hi All,

A gentle reminder for my patches.
Any comments or updates will be helpful!

Regards, Prasant

maintainer
#3 lore raw

Re: [PATCH 2/2] staging: sm750fb: removed line continuations in quoted strings

Quoted 1 line · Prasant Jalan

On Sat, Apr 1, 2017 at 12:40 AM, Prasant Jalan <[email protected]> wrote:

<snip>

Quoted 2 lines

A gentle reminder for my patches.
Any comments or updates will be helpful!

2 days, over a weekend, for a coding style change is pretty fast, don't you agree? I will get to these eventually, usually every other week I flush them all out.

Please be patient, don't worry, the patch is not lost.

thanks,

greg k-h