Skip to contentSkip to conversation

omap3isp: Ignore endpoints with invalid configuration

RFC In review Sakari Ailus 2 participants 6 messages Feb 28, 2017 – Mar 1, 2017 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

RFC 1/1 omap3isp: Ignore endpoints with invalid configuration

If endpoint has an invalid configuration, ignore it instead of happily proceeding to use it nonetheless. Ignoring such an endpoint is better than failing since there could be multiple endpoints, only some of which are bad.

---
Hi Pavel,

How about this one? isp_fwnode_parse() is expected to return an error if there's one but currently it's quite shy. With this patch, the faulty endpoint is simply ignored. This is completely untested so far.

 drivers/media/platform/omap3isp/isp.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/media/platform/omap3isp/isp.c +5 -3
index 95850b9..8026221 100644
@@ -2120,10 +2120,12 @@ static int isp_fwnodes_parse(struct device *dev,
 		if (!isd)
 			goto error;
 
-		notifier->subdevs[notifier->num_subdevs] = &isd->asd;
+		if (isp_fwnode_parse(dev, fwn, isd)) {
+			devm_kfree(dev, isd);
+			continue;
+		}
 
-		if (isp_fwnode_parse(dev, fwn, isd))
-			goto error;
+		notifier->subdevs[notifier->num_subdevs] = &isd->asd;
 
 		isd->asd.match.fwnode.fwn =
 			fwnode_graph_get_remote_port_parent(fwn);
Signature · 1 line
2.7.4
Tested-by on v1 1/1
#1 lore raw
Quoted 5 lines · Sakari Ailus

If endpoint has an invalid configuration, ignore it instead of happily proceeding to use it nonetheless. Ignoring such an endpoint is better than failing since there could be multiple endpoints, only some of which are bad.

Quoted 7 lines

---
Hi Pavel,

How about this one? isp_fwnode_parse() is expected to return an error if there's one but currently it's quite shy. With this patch, the faulty endpoint is simply ignored. This is completely untested so far.

Does not seem to break anything.

Pavel

Quoted 23 lines
 drivers/media/platform/omap3isp/isp.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/media/platform/omap3isp/isp.c +5 -3
index 95850b9..8026221 100644
@@ -2120,10 +2120,12 @@ static int isp_fwnodes_parse(struct device *dev,
 		if (!isd)
 			goto error;
 
-		notifier->subdevs[notifier->num_subdevs] = &isd->asd;
+		if (isp_fwnode_parse(dev, fwn, isd)) {
+			devm_kfree(dev, isd);
+			continue;
+		}
 
-		if (isp_fwnode_parse(dev, fwn, isd))
-			goto error;
+		notifier->subdevs[notifier->num_subdevs] = &isd->asd;
 
 		isd->asd.match.fwnode.fwn =
 			fwnode_graph_get_remote_port_parent(fwn);
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#5 lore raw
Quoted 7 lines · Sakari Ailus
Quoted 6 lines · Pavel Machek
Quoted 5 lines · Sakari Ailus
Quoted 1 line · Pavel Machek

Thanks!

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

I've applied the patch, plus yours, to the ccp2 branch.

Thanks!

https://git.linuxtv.org/sailus/media_tree.git/log/?h=ccp2 ? I don't see recent changes there...

I accidentally pushed it to a wrong place. Pushing again...

Thanks, I see it now.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html