device: check hw methods being present

This commit is contained in:
Kamil Trzcinski 2023-02-24 19:59:54 +01:00
parent 27b93facc9
commit 6c14564e75
2 changed files with 7 additions and 7 deletions

View File

@ -86,7 +86,7 @@ void buffer_list_close(buffer_list_t *buf_list)
int buffer_list_set_stream(buffer_list_t *buf_list, bool do_on) int buffer_list_set_stream(buffer_list_t *buf_list, bool do_on)
{ {
if (!buf_list) { if (!buf_list || !buf_list->dev->hw->buffer_list_set_stream) {
return -1; return -1;
} }

View File

@ -181,10 +181,10 @@ int device_set_stream(device_t *dev, bool do_on)
int device_video_force_key(device_t *dev) int device_video_force_key(device_t *dev)
{ {
if (!dev || dev->hw->device_video_force_key(dev) < 0) if (dev && dev->hw->device_video_force_key)
return -1; return dev->hw->device_video_force_key(dev);
return 0; return -1;
} }
void device_dump_options(device_t *dev, FILE *stream) void device_dump_options(device_t *dev, FILE *stream)
@ -235,11 +235,11 @@ int device_set_rotation(device_t *dev, bool vflip, bool hflip)
int device_set_option_string(device_t *dev, const char *key, const char *value) int device_set_option_string(device_t *dev, const char *key, const char *value)
{ {
if (!dev) { if (dev && dev->hw->device_set_option) {
return 0; return dev->hw->device_set_option(dev, key, value);
} }
return dev->hw->device_set_option(dev, key, value); return -1;
} }
void device_set_option_list(device_t *dev, const char *option_list) void device_set_option_list(device_t *dev, const char *option_list)