Skip to contentSkip to conversation

media: ti-vpe: Fix a missing check and reference count leak

bug report Dan Carpenter 1 participant 1 message Sep 29, 2020 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hello Qiushi Wu,

The patch 7dae2aaaf432: "media: ti-vpe: Fix a missing check and reference count leak" from Jun 14, 2020, leads to the following static checker warning:

	drivers/media/platform/ti-vpe/vpe.c:2478 vpe_runtime_get()
	warn: pm_runtime_get_sync() also returns 1 on success

drivers/media/platform/ti-vpe/vpe.c
2470 static int vpe_runtime_get(struct platform_device *pdev) 2471 {
2472 int r;
2473
2474 dev_dbg(&pdev->dev, "vpe_runtime_get\n");
2475

  2476          r = pm_runtime_get_sync(&pdev->dev);
  2477          WARN_ON(r < 0);
  2478          if (r)

2479 pm_runtime_put_noidle(&pdev->dev);

The pm_runtime_get_sync() function is tricky because it can return either zero or one on the success path. (So this patch can break the success path.)

2480 return r < 0 ? r : 0;
2481 }

regards,
dan carpenter