Commits
Robby Cai committed 00bb85342bb
media: ov5640: fix kernel warning when no camera is plugged in in 5451781dadf85000665e0e2c3288e9e0f34b860a commit, it added the check that the regulator need to be disabled before calling regulator_put(). If not do so, the kernel will print warning message as below. To fix this, need to disable regulator before probe function return if the camera's not found. regulator_put() will be called when probe fails in this case as devm_regulator_get() already called in probe function. [ 11.342219] ------------[ cut here ]------------ [ 11.347211] WARNING: CPU: 0 PID: 314 at drivers/regulator/core.c:2039 _regulator_put.part.4+0x100/0x120 [ 11.356861] Modules linked in: ov5640_camera_mipi_int(+) ov5640_camera_int(+) v4l2_int_device [ 11.365604] CPU: 0 PID: 314 Comm: systemd-udevd Tainted: G W O 5.3.0-rc3-next-20190809-02774-g6e085ec #18 [ 11.376346] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) [ 11.382947] [<c0112868>] (unwind_backtrace) from [<c010cd9c>] (show_stack+0x10/0x14) [ 11.390758] [<c010cd9c>] (show_stack) from [<c0d26ad4>] (dump_stack+0xd8/0x110) [ 11.398120] [<c0d26ad4>] (dump_stack) from [<c01362c4>] (__warn.part.3+0xa8/0xe8) [ 11.405636] [<c01362c4>] (__warn.part.3) from [<c013645c>] (warn_slowpath_null+0x40/0x4c) [ 11.414007] [<c013645c>] (warn_slowpath_null) from [<c05e6520>] (_regulator_put.part.4+0x100/0x120) [ 11.414045] [<c05e6520>] (_regulator_put.part.4) from [<c05e656c>] (regulator_put+0x2c/0x3c) [ 11.414063] [<c05e656c>] (regulator_put) from [<c06dce90>] (release_nodes+0x1ac/0x1f8) [ 11.414082] [<c06dce90>] (release_nodes) from [<c06d8968>] (really_probe+0x104/0x340) [ 11.414097] [<c06d8968>] (really_probe) from [<c06d8d50>] (driver_probe_device+0x84/0x194) [ 11.414112] [<c06d8d50>] (driver_probe_device) from [<c06d9044>] (device_driver_attach+0x58/0x60) [ 11.414126] [<c06d9044>] (device_driver_attach) from [<c06d90a4>] (__driver_attach+0x58/0xd0) [ 11.414141] [<c06d90a4>] (__driver_attach) from [<c06d6d70>] (bus_for_each_dev+0x70/0xb4) [ 11.414154] [<c06d6d70>] (bus_for_each_dev) from [<c06d7d9c>] (bus_add_driver+0x198/0x1d0) [ 11.414168] [<c06d7d9c>] (bus_add_driver) from [<c06d9d30>] (driver_register+0x74/0x108) [ 11.414186] [<c06d9d30>] (driver_register) from [<c088ae30>] (i2c_register_driver+0x38/0x84) [ 11.414203] [<c088ae30>] (i2c_register_driver) from [<c0103078>] (do_one_initcall+0x80/0x338) [ 11.414223] [<c0103078>] (do_one_initcall) from [<c01e163c>] (do_init_module+0x5c/0x238) [ 11.414236] [<c01e163c>] (do_init_module) from [<c01e3b00>] (load_module+0x2260/0x256c) [ 11.414250] [<c01e3b00>] (load_module) from [<c01e4060>] (sys_finit_module+0xbc/0xdc) [ 11.414263] [<c01e4060>] (sys_finit_module) from [<c0101000>] (ret_fast_syscall+0x0/0x28) [ 11.414272] Exception stack(0xeda6bfa8 to 0xeda6bff0) [ 11.414284] bfa0: 00000000 00000000 0000000f b6f167e8 00000000 007ecba0 [ 11.414297] bfc0: 00000000 00000000 beebbddc 0000017b 00000000 00000000 beebbda0 007f7db0 [ 11.414307] bfe0: beebbd08 beebbcf8 b6f0ed84 b6d81510 [ 11.414423] irq event stamp: 16217 [ 11.414445] hardirqs last enabled at (16223): [<c019d9f4>] vprintk_emit+0x294/0x2c8 [ 11.414458] hardirqs last disabled at (16228): [<c019d884>] vprintk_emit+0x124/0x2c8 [ 11.414472] softirqs last enabled at (16192): [<c01024e4>] __do_softirq+0x2c4/0x514 [ 11.414489] softirqs last disabled at (16137): [<c013da4c>] irq_exit+0x100/0x188 [ 11.414498] ---[ end trace 13b19ccc3a78aa43 ]--- Signed-off-by: Robby Cai <robby.cai@nxp.com> (cherry picked from commit 14d7e9fc1249f8d8ed81743c42e157fcd6598ac9)