Re: [PATCH v2] Input: omap-keypad: Fix error goto and handling in omap4_keypad_probe
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2020-11-23 06:46:50
Hi, On Fri, Nov 20, 2020 at 09:39:18PM +0800, Zhang Qilong wrote:
quoted hunk ↗ jump to hunk
@@ -269,41 +298,32 @@ static int omap4_keypad_probe(struct platform_device *pdev) goto err_release_mem; } + pm_runtime_enable(&pdev->dev); /* * Enable clocks for the keypad module so that we can read * revision register. */ - pm_runtime_enable(&pdev->dev); error = pm_runtime_get_sync(&pdev->dev); if (error) { + pm_runtime_put_noidle(&pdev->dev); dev_err(&pdev->dev, "pm_runtime_get_sync() failed\n"); - goto err_unmap; - } - rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION); - rev &= 0x03 << 30; - rev >>= 30; - switch (rev) { - case KBD_REVISION_OMAP4: - keypad_data->reg_offset = 0x00; - keypad_data->irqreg_offset = 0x00; - break; - case KBD_REVISION_OMAP5: - keypad_data->reg_offset = 0x10; - keypad_data->irqreg_offset = 0x0c; - break; - default: - dev_err(&pdev->dev, - "Keypad reports unsupported revision %d", rev); - error = -EINVAL; - goto err_pm_put_sync; + goto err_pm_disable; + } else { + error = omap4_keypad_check_revision(&pdev->dev, + keypad_data); + if (!error) { + /* Ensure device does not raise interrupts */ + omap4_keypad_stop(keypad_data); + } + pm_runtime_put_sync(&pdev->dev); }
So here there I mean to have if (error) goto err_pm_disable; I added it (and removed "goto" from the branch above) and applied, thank you. -- Dmitry