Skip to contentSkip to conversation

WL1273: Adjustments for two function implementations

PATCH New SF Markus Elfring 1 participant 4 messages Sep 16, 2017

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

cover WL1273: Adjustments for two function implementations

From: Markus Elfring <[email protected]>
Date: Sat, 16 Sep 2017 14:05:45 +0200

Three update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
Delete an error message for a failed memory allocation Delete an unnecessary goto statement
Delete an unnecessary variable initialisation

 drivers/media/radio/radio-wl1273.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/3 WL1273: Delete an error message for a failed memory allocation in wl1273_fm_radio_probe()

From: Markus Elfring <[email protected]>
Date: Sat, 16 Sep 2017 13:28:38 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

---
 drivers/media/radio/radio-wl1273.c | 1 -
 1 file changed, 1 deletion(-)
drivers/media/radio/radio-wl1273.c +0 -1
index 903fcd5e99c0..020a792173f6 100644
@@ -2034,5 +2034,4 @@ static int wl1273_fm_radio_probe(struct platform_device *pdev)
 	if (!radio->buffer) {
-		pr_err("Cannot allocate memory for RDS buffer.\n");
 		r = -ENOMEM;
 		goto pdata_err;
 	}
Signature · 1 line
2.14.1
#2 lore raw

PATCH 2/3 WL1273: Delete an unnecessary goto statement in wl1273_fm_suspend()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 16 Sep 2017 13:53:22 +0200

* Remove an extra goto statement.

* Delete the label "out" which became unnecessary with this refactoring.

---
 drivers/media/radio/radio-wl1273.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/media/radio/radio-wl1273.c +1 -4
index 020a792173f6..74dc3195ea2c 100644
@@ -683,12 +683,9 @@ static int wl1273_fm_suspend(struct wl1273_device *radio)
 	else
 		r = -EINVAL;
 
-	if (r) {
+	if (r)
 		dev_err(radio->dev, "%s: POWER_SET fails: %d\n", __func__, r);
-		goto out;
-	}
 
-out:
 	return r;
 }
 
Signature · 1 line
2.14.1
#3 lore raw

PATCH 3/3 WL1273: Delete an unnecessary variable initialisation in wl1273_fm_suspend()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Sat, 16 Sep 2017 13:55:56 +0200

The local variable "r" will be set to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning.

---
 drivers/media/radio/radio-wl1273.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/radio/radio-wl1273.c +1 -1
index 74dc3195ea2c..b8f08bfc31c3 100644
@@ -671,6 +671,6 @@ static int wl1273_fm_start(struct wl1273_device *radio, int new_mode)
 static int wl1273_fm_suspend(struct wl1273_device *radio)
 {
 	struct wl1273_core *core = radio->core;
-	int r = 0;
+	int r;
 
 	/* Cannot go from OFF to SUSPENDED */
Signature · 1 line
2.14.1