Skip to contentSkip to conversation

uda134x: properly free allocated memory if uda134x_soc_probe fail with unknown codec type

PATCH New Axel Lin 1 participant 1 message Jul 16, 2010

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 uda134x: properly free allocated memory if uda134x_soc_probe fail with unknown codec type

If uda134x_soc_probe fail with unknown codec type, it should properly free allocated memory before return -EINVAL.

---
This case won't be executed in current implementation because there is a model checking in the begin of uda134x_soc_probe.
But since the code is there, I think it's good to make it correct. Otherwise, we can simply remove the default case.

 sound/soc/codecs/uda134x.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
sound/soc/codecs/uda134x.c +2 -1
index 28aac53..9bff3c6 100644
@@ -566,9 +566,10 @@ static int uda134x_soc_probe(struct platform_device *pdev)
 					ARRAY_SIZE(uda1345_snd_controls));
 	break;
 	default:
+		ret = -EINVAL;
 		printk(KERN_ERR "%s unknown codec type: %d",
 			__func__, pd->model);
-	return -EINVAL;
+	break;
 	}
 
 	if (ret < 0) {
Signature · 1 line
1.5.4.3