From: Dan Carpenter <error27@gmail.com>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
Vaibhav Hiremath <hvaibhav@ti.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Muralidharan Karicheri <m-karicheri2@ti.com>,
linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] davinci: don't return under lock on error path
Date: Wed, 07 Apr 2010 09:21:05 +0000 [thread overview]
Message-ID: <20100407092105.GC5157@bicker> (raw)
If the kmalloc() failed for "ccdc_cfg = kmalloc(...);" then we would exit
with the lock held. I moved the mutex_lock() below the allocation
because it isn't protecting anything in that block and allocations are
allocations are sometimes slow.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c
index 7cf042f..5c83f90 100644
--- a/drivers/media/video/davinci/vpfe_capture.c
+++ b/drivers/media/video/davinci/vpfe_capture.c
@@ -1824,7 +1824,6 @@ static __init int vpfe_probe(struct platform_device *pdev)
goto probe_free_dev_mem;
}
- mutex_lock(&ccdc_lock);
/* Allocate memory for ccdc configuration */
ccdc_cfg = kmalloc(sizeof(struct ccdc_config), GFP_KERNEL);
if (NULL = ccdc_cfg) {
@@ -1833,6 +1832,8 @@ static __init int vpfe_probe(struct platform_device *pdev)
goto probe_free_dev_mem;
}
+ mutex_lock(&ccdc_lock);
+
strncpy(ccdc_cfg->name, vpfe_cfg->ccdc, 32);
/* Get VINT0 irq resource */
res1 = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
Vaibhav Hiremath <hvaibhav@ti.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Muralidharan Karicheri <m-karicheri2@ti.com>,
linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] davinci: don't return under lock on error path
Date: Wed, 7 Apr 2010 12:21:05 +0300 [thread overview]
Message-ID: <20100407092105.GC5157@bicker> (raw)
If the kmalloc() failed for "ccdc_cfg = kmalloc(...);" then we would exit
with the lock held. I moved the mutex_lock() below the allocation
because it isn't protecting anything in that block and allocations are
allocations are sometimes slow.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c
index 7cf042f..5c83f90 100644
--- a/drivers/media/video/davinci/vpfe_capture.c
+++ b/drivers/media/video/davinci/vpfe_capture.c
@@ -1824,7 +1824,6 @@ static __init int vpfe_probe(struct platform_device *pdev)
goto probe_free_dev_mem;
}
- mutex_lock(&ccdc_lock);
/* Allocate memory for ccdc configuration */
ccdc_cfg = kmalloc(sizeof(struct ccdc_config), GFP_KERNEL);
if (NULL == ccdc_cfg) {
@@ -1833,6 +1832,8 @@ static __init int vpfe_probe(struct platform_device *pdev)
goto probe_free_dev_mem;
}
+ mutex_lock(&ccdc_lock);
+
strncpy(ccdc_cfg->name, vpfe_cfg->ccdc, 32);
/* Get VINT0 irq resource */
res1 = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
next reply other threads:[~2010-04-07 9:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-07 9:21 Dan Carpenter [this message]
2010-04-07 9:21 ` [patch] davinci: don't return under lock on error path Dan Carpenter
2010-04-07 9:25 ` Hiremath, Vaibhav
2010-04-07 9:37 ` Hiremath, Vaibhav
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100407092105.GC5157@bicker \
--to=error27@gmail.com \
--cc=hvaibhav@ti.com \
--cc=hverkuil@xs4all.nl \
--cc=kernel-janitors@vger.kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=m-karicheri2@ti.com \
--cc=mchehab@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.