Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: mmp: Bring back registration of the device

In commit 4af65141e38e ("media: marvell: cafe: Register V4L2 device
earlier"), a call to v4l2_device_register() was moved away from
mccic_register() into its caller, marvell/cafe's cafe_pci_probe().
This is not the only caller though -- there's also marvell/mmp.

Add v4l2_device_register() into mmpcam_probe() to unbreak the MMP camera
driver, in a fashion analogous to what's been done to the Cafe driver.
Same for the teardown path.

Fixes: 4af65141e38e ("media: marvell: cafe: Register V4L2 device earlier")
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Cc: stable@vger.kernel.org # v6.6+
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>

authored by

Lubomir Rintel and committed by
Hans Verkuil
fbb5298b d76bf526

+17 -4
+17 -4
drivers/media/platform/marvell/mmp-driver.c
··· 232 232 mcam_init_clk(mcam); 233 233 234 234 /* 235 + * Register with V4L. 236 + */ 237 + 238 + ret = v4l2_device_register(mcam->dev, &mcam->v4l2_dev); 239 + if (ret) 240 + return ret; 241 + 242 + /* 235 243 * Create a match of the sensor against its OF node. 236 244 */ 237 245 ep = fwnode_graph_get_next_endpoint(of_fwnode_handle(pdev->dev.of_node), 238 246 NULL); 239 - if (!ep) 240 - return -ENODEV; 247 + if (!ep) { 248 + ret = -ENODEV; 249 + goto out_v4l2_device_unregister; 250 + } 241 251 242 252 v4l2_async_nf_init(&mcam->notifier, &mcam->v4l2_dev); 243 253 ··· 256 246 fwnode_handle_put(ep); 257 247 if (IS_ERR(asd)) { 258 248 ret = PTR_ERR(asd); 259 - goto out; 249 + goto out_v4l2_device_unregister; 260 250 } 261 251 262 252 /* ··· 264 254 */ 265 255 ret = mccic_register(mcam); 266 256 if (ret) 267 - goto out; 257 + goto out_v4l2_device_unregister; 268 258 269 259 /* 270 260 * Add OF clock provider. ··· 293 283 return 0; 294 284 out: 295 285 mccic_shutdown(mcam); 286 + out_v4l2_device_unregister: 287 + v4l2_device_unregister(&mcam->v4l2_dev); 296 288 297 289 return ret; 298 290 } ··· 305 293 struct mcam_camera *mcam = &cam->mcam; 306 294 307 295 mccic_shutdown(mcam); 296 + v4l2_device_unregister(&mcam->v4l2_dev); 308 297 pm_runtime_force_suspend(mcam->dev); 309 298 } 310 299