linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 13/13] staging: sm750: move assignment out of if cond
@ 2015-03-22 23:15 Michel von Czettritz
  2015-03-23 11:29 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Michel von Czettritz @ 2015-03-22 23:15 UTC (permalink / raw)
  To: linux-fbdev

This patch moves the assignments from the if conditions to the line before the condition.
The 3 occurrence are return values and the checks for errors.

Signed-off-by: Michel von Czettritz <michel.von.czettritz@gmail.com>
---
 drivers/staging/sm750fb/sm750.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index c250882..a4a7fed 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -474,7 +474,8 @@ static int lynxfb_resume(struct pci_dev *pdev)
 
 	console_lock();
 
-	if ((ret = pci_set_power_state(pdev, PCI_D0)) != 0) {
+	ret = pci_set_power_state(pdev, PCI_D0);
+	if (ret != 0) {
 		pr_err("error:%d occured in pci_set_power_state\n", ret);
 		return ret;
 	}
@@ -482,7 +483,8 @@ static int lynxfb_resume(struct pci_dev *pdev)
 
 	if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) {
 		pci_restore_state(pdev);
-		if ((ret = pci_enable_device(pdev)) != 0) {
+		ret = pci_enable_device(pdev);
+		if (ret != 0) {
 			pr_err("error:%d occured in pci_enable_device\n", ret);
 			return ret;
 		}
@@ -971,7 +973,8 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
 			info->cmap.red, info->cmap.green, info->cmap.blue,
 			info->cmap.transp);
 
-	if ((ret = fb_alloc_cmap(&info->cmap, 256, 0)) < 0) {
+	ret = fb_alloc_cmap(&info->cmap, 256, 0);
+	if (ret < 0) {
 		pr_err("Could not allcate memory for cmap.\n");
 		goto exit;
 	}
-- 
2.3.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 13/13] staging: sm750: move assignment out of if cond
  2015-03-22 23:15 [PATCH 13/13] staging: sm750: move assignment out of if cond Michel von Czettritz
@ 2015-03-23 11:29 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2015-03-23 11:29 UTC (permalink / raw)
  To: linux-fbdev

On Mon, Mar 23, 2015 at 12:15:16AM +0100, Michel von Czettritz wrote:
> This patch moves the assignments from the if conditions to the line before the condition.
> The 3 occurrence are return values and the checks for errors.
> 
> Signed-off-by: Michel von Czettritz <michel.von.czettritz@gmail.com>
> ---
>  drivers/staging/sm750fb/sm750.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
> index c250882..a4a7fed 100644
> --- a/drivers/staging/sm750fb/sm750.c
> +++ b/drivers/staging/sm750fb/sm750.c
> @@ -474,7 +474,8 @@ static int lynxfb_resume(struct pci_dev *pdev)
>  
>  	console_lock();
>  
> -	if ((ret = pci_set_power_state(pdev, PCI_D0)) != 0) {
> +	ret = pci_set_power_state(pdev, PCI_D0);
> +	if (ret != 0) {

Use "if (ret) ".  The double negative is not not a waste of time.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-23 11:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-22 23:15 [PATCH 13/13] staging: sm750: move assignment out of if cond Michel von Czettritz
2015-03-23 11:29 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).