Message ID | CAPGEy5dSSg1GsTYzWJXYEpSBRLDc7WSF+7-WdFaVJWCuR4XyCg@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Jose, On Thu, May 9, 2013 at 10:58 PM, Jose Pablo Carballo <jose.carballo@ridgerun.com> wrote: > Hi, > > On file drivers/media/platform/davinci/vpfe_capture.c, function > vpfe_probe(): > > diff --git a/drivers/media/platform/davinci/vpfe_capture.c > b/drivers/media/platform/davinci/vpfe_capture.c > index 28d019d..1d9a12d 100644 > --- a/drivers/media/platform/davinci/vpfe_capture.c > +++ b/drivers/media/platform/davinci/vpfe_capture.c > @@ -1866,6 +1866,8 @@ static 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) { > @@ -1874,8 +1876,6 @@ static int vpfe_probe(struct platform_device *pdev) > goto probe_free_lock; > } > > - mutex_lock(&ccdc_lock); > - > strncpy(ccdc_cfg->name, vpfe_cfg->ccdc, 32); > /* Get VINT0 irq resource */ > res1 = platform_get_resource(pdev, IORESOURCE_IRQ, 0); > > > The check NULL == ccdc_cfg takes the function to probe_free_lock on error, > which unlocks the mutex that has not been previously locked. > Thanks for the finding, but the better fix would have been to just change the go label to probe_free_dev_mem, I have posted a patch https://patchwork.linuxtv.org/patch/18367/ with it. Regards, --Prabhakar Lad
diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c index 28d019d..1d9a12d 100644 --- a/drivers/media/platform/davinci/vpfe_capture.c +++ b/drivers/media/platform/davinci/vpfe_capture.c @@ -1866,6 +1866,8 @@ static 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) { @@ -1874,8 +1876,6 @@ static int vpfe_probe(struct platform_device *pdev) goto probe_free_lock; } - mutex_lock(&ccdc_lock); - strncpy(ccdc_cfg->name, vpfe_cfg->ccdc, 32); /* Get VINT0 irq resource */ res1 = platform_get_resource(pdev, IORESOURCE_IRQ, 0);