]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[media] pxa_camera: Fix a call with an uninitialized device pointer
authorPetr Cvek <petr.cvek@tul.cz>
Mon, 1 May 2017 04:21:57 +0000 (01:21 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 6 Jun 2017 10:41:10 +0000 (07:41 -0300)
In 'commit 295ab497d6357 ("[media] media: platform: pxa_camera: make
printk consistent")' a pointer to the device structure in
mclk_get_divisor() was changed to pcdev_to_dev(pcdev). The pointer used
by pcdev_to_dev() is still uninitialized during the call to
mclk_get_divisor() as it happens in v4l2_device_register() at the end
of the probe. The dev_warn and dev_dbg caused a line in the log:

(NULL device *): Limiting master clock to 26000000

Fix this by using an initialized pointer from the platform_device
(as before the old patch).

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/pxa_camera.c

index ab1fa911849a89ac01d8fb3f2e2ce6c69632cfa3..25e538bf0df79fc5be10fb478a5078b2a90cb485 100644 (file)
@@ -1124,7 +1124,7 @@ static u32 mclk_get_divisor(struct platform_device *pdev,
        /* mclk <= ciclk / 4 (27.4.2) */
        if (mclk > lcdclk / 4) {
                mclk = lcdclk / 4;
-               dev_warn(pcdev_to_dev(pcdev),
+               dev_warn(&pdev->dev,
                         "Limiting master clock to %lu\n", mclk);
        }
 
@@ -1135,7 +1135,7 @@ static u32 mclk_get_divisor(struct platform_device *pdev,
        if (pcdev->platform_flags & PXA_CAMERA_MCLK_EN)
                pcdev->mclk = lcdclk / (2 * (div + 1));
 
-       dev_dbg(pcdev_to_dev(pcdev), "LCD clock %luHz, target freq %luHz, divisor %u\n",
+       dev_dbg(&pdev->dev, "LCD clock %luHz, target freq %luHz, divisor %u\n",
                lcdclk, mclk, div);
 
        return div;