Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933253AbcJURMs (ORCPT ); Fri, 21 Oct 2016 13:12:48 -0400 Received: from anholt.net ([50.246.234.109]:55996 "EHLO anholt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754872AbcJURMn (ORCPT ); Fri, 21 Oct 2016 13:12:43 -0400 From: Eric Anholt To: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org, Rob Herring , Eric Anholt Subject: [PATCH libdrm 1/2] Return an -ENODEV from drmGetDevice() when no device was found. Date: Fri, 21 Oct 2016 10:12:39 -0700 Message-Id: <20161021171240.6972-1-eric@anholt.net> X-Mailer: git-send-email 2.9.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 609 Lines: 27 From: Rob Herring Fixes crashes in Mesa on platform device, which expected *device to have a device when 0 was returned. (code from a paste by Rob, commit message by anholt) Signed-off-by: Eric Anholt --- xf86drm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xf86drm.c b/xf86drm.c index 9cfca49ddfda..9b52889e4cef 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -3181,6 +3181,8 @@ int drmGetDevice(int fd, drmDevicePtr *device) closedir(sysdir); free(local_devices); + if (*device == NULL) + return -ENODEV; return 0; free_devices: -- 2.9.3