driver: fix a potential Null reference.
driver: fix a potential Null reference.

cl_gpgpu_flush may be called when the batch buffer has been
released. We need to check whether there is a valid buffer
before we really take the following actions.

Signed-off-by: Zhigang Gong <e04a7b9b70b1e4c6318cf117dcd1a9056e14b97a@intel.com>
Reviewed-by:  He Junyan <8f73a735c668918c9613b750d3a88ebf2489599f@inbox.com>

zhenyw/beignet,zhenyw/beignet,freedesktop-unofficial-mirror/beignet,wdv4758h/beignet,zhenyw/beignet,wdv4758h/beignet,zhenyw/beignet,wdv4758h/beignet,wdv4758h/beignet,freedesktop-unofficial-mirror/beignet,zhenyw/beignet,freedesktop-unofficial-mirror/beignet,wdv4758h/beignet,freedesktop-unofficial-mirror/beignet