diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index 06448c657d14e89ba1efae8d21d48b0b669b4768..ad82ef6b2dac66313a7a581dfcf7b281377a21e7 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -1361,10 +1361,7 @@ static int opencl_device_derive(AVHWDeviceContext *hwdev,
         break;
     }
 
-    if (err < 0)
-        return err;
-
-    return opencl_device_init(hwdev);
+    return err;
 }
 
 static int opencl_get_plane_format(enum AVPixelFormat pixfmt,