[PATCH -next] media: imx-jpeg: Fix return value check in mxc_jpeg_attach_pm_domains()

'w00385741 weiyongjun1 at huawei.com
Tue Mar 23 11:29:03 GMT 2021


From: Wei Yongjun <weiyongjun1 at huawei.com>

In case of error, the function device_link_add() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value
check should be replaced with NULL test.

Fixes: 2db16c6ed72c ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder")
Reported-by: Hulk Robot <hulkci at huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1 at huawei.com>
---
 drivers/media/platform/imx-jpeg/mxc-jpeg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/imx-jpeg/mxc-jpeg.c
index 2d29558f1864..9509eb9d939a 100644
--- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c
+++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c
@@ -1943,8 +1943,8 @@ static int mxc_jpeg_attach_pm_domains(struct mxc_jpeg_dev *jpeg)
 						   DL_FLAG_STATELESS |
 						   DL_FLAG_PM_RUNTIME |
 						   DL_FLAG_RPM_ACTIVE);
-		if (IS_ERR(jpeg->pd_link[i])) {
-			ret = PTR_ERR(jpeg->pd_link[i]);
+		if (!jpeg->pd_link[i]) {
+			ret = -EINVAL;
 			goto fail;
 		}
 	}




More information about the linux-arm-kernel mailing list