From a147d4c54575e1ee3705a3cc77e0fa6a6d2e22fb Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 26 Aug 2015 08:13:56 +1000 Subject: [PATCH] driver-hidpp10: don't set the resolution when the request fails Signed-off-by: Peter Hutterer --- src/driver-hidpp10.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/driver-hidpp10.c b/src/driver-hidpp10.c index 643b5594..b4cea6e5 100644 --- a/src/driver-hidpp10.c +++ b/src/driver-hidpp10.c @@ -89,14 +89,18 @@ hidpp10drv_read_profile(struct ratbag_profile *profile, unsigned int index) struct hidpp10drv_data *drv_data; struct hidpp10_device *hidpp10; uint16_t xres, yres, refresh; + int rc; drv_data = ratbag_get_drv_data(device); hidpp10 = drv_data->dev; - hidpp10_get_current_resolution(hidpp10, &xres, &yres); - hidpp10_get_usb_refresh_rate(hidpp10, &refresh); - profile->current_dpi = xres; - profile->report_rate = refresh; + rc = hidpp10_get_current_resolution(hidpp10, &xres, &yres); + if (rc == 0) + profile->current_dpi = xres; + + rc = hidpp10_get_usb_refresh_rate(hidpp10, &refresh); + if (rc == 0) + profile->report_rate = refresh; } static int