Skip to contentSkip to conversation

hwrng: cctrng - drop redundant initializations

PATCH In review Thorsten Blum 2 participants 2 messages Oct 1 – Oct 8

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

PATCH v2 1/1 hwrng: cctrng - drop redundant initializations

The variables are reassigned before their initial values are read - drop the redundant initializations.

---
Changes in v2:
- Missed two redundant initializations
- v1: https://lore.kernel.org/r/[email protected]/

---
 drivers/char/hw_random/cctrng.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/char/hw_random/cctrng.c +6 -6
index 51290ea345c3..be35f058f37a 100644
@@ -91,7 +91,7 @@ static int cc_trng_pm_get(struct device *dev)
 
 static void cc_trng_pm_put_suspend(struct device *dev)
 {
-	int rc = 0;
+	int rc;
 
 	rc = pm_runtime_put_autosuspend(dev);
 	if (rc)
@@ -208,7 +208,7 @@ static int cctrng_read(struct hwrng *rng, void *data, size_t max, bool wait)
 	struct cctrng_drvdata *drvdata = (struct cctrng_drvdata *)rng->priv;
 	struct device *dev = &(drvdata->pdev->dev);
 	u32 *buf = (u32 *)drvdata->circ.buf;
-	size_t copied = 0;
+	size_t copied;
 	size_t cnt_w;
 	size_t size;
 	size_t left;
@@ -268,7 +268,7 @@ static int cctrng_read(struct hwrng *rng, void *data, size_t max, bool wait)
 
 static void cc_trng_hw_trigger(struct cctrng_drvdata *drvdata)
 {
-	u32 tmp_smpl_cnt = 0;
+	u32 tmp_smpl_cnt;
 	struct device *dev = &(drvdata->pdev->dev);
 
 	dev_dbg(dev, "cctrng hw trigger.\n");
@@ -309,8 +309,8 @@ static void cc_trng_hw_trigger(struct cctrng_drvdata *drvdata)
 
 static void cc_trng_compwork_handler(struct work_struct *w)
 {
-	u32 isr = 0;
-	u32 ehr_valid = 0;
+	u32 isr;
+	u32 ehr_valid;
 	struct cctrng_drvdata *drvdata =
 			container_of(w, struct cctrng_drvdata, compwork);
 	struct device *dev = &(drvdata->pdev->dev);
@@ -453,7 +453,7 @@ static int cctrng_probe(struct platform_device *pdev)
 {
 	struct cctrng_drvdata *drvdata;
 	struct device *dev = &pdev->dev;
-	int rc = 0;
+	int rc;
 	u32 val;
 	int irq;
 
maintainer
#1 lore raw
Quoted 11 lines · Thorsten Blum

The variables are reassigned before their initial values are read - drop the redundant initializations.

---
Changes in v2:
- Missed two redundant initializations
- v1: https://lore.kernel.org/r/[email protected]/

---
 drivers/char/hw_random/cctrng.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt