* [PATCH v2 3/3] [media] exynos4-is: Fix potential NULL pointer dereference
@ 2013-08-02 8:58 Sachin Kamat
0 siblings, 0 replies; only message in thread
From: Sachin Kamat @ 2013-08-02 8:58 UTC (permalink / raw)
To: linux-media; +Cc: s.nawrocki, sachin.kamat, patches
dev->of_node could be NULL. Hence check for the same and return before
dereferencing it in the subsequent error message.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
Changes since v1:
Moved the NULL check to beginning of probe.
---
drivers/media/platform/exynos4-is/fimc-lite.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c
index 08fbfed..318d4c3 100644
--- a/drivers/media/platform/exynos4-is/fimc-lite.c
+++ b/drivers/media/platform/exynos4-is/fimc-lite.c
@@ -1504,16 +1504,17 @@ static int fimc_lite_probe(struct platform_device *pdev)
struct resource *res;
int ret;
+ if (!dev->of_node)
+ return -ENODEV;
+
fimc = devm_kzalloc(dev, sizeof(*fimc), GFP_KERNEL);
if (!fimc)
return -ENOMEM;
- if (dev->of_node) {
- of_id = of_match_node(flite_of_match, dev->of_node);
- if (of_id)
- drv_data = (struct flite_drvdata *)of_id->data;
- fimc->index = of_alias_get_id(dev->of_node, "fimc-lite");
- }
+ of_id = of_match_node(flite_of_match, dev->of_node);
+ if (of_id)
+ drv_data = (struct flite_drvdata *)of_id->data;
+ fimc->index = of_alias_get_id(dev->of_node, "fimc-lite");
if (!drv_data || fimc->index >= drv_data->num_instances ||
fimc->index < 0) {
--
1.7.9.5
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-08-02 9:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-02 8:58 [PATCH v2 3/3] [media] exynos4-is: Fix potential NULL pointer dereference Sachin Kamat
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).