Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933445AbcJURYz (ORCPT ); Fri, 21 Oct 2016 13:24:55 -0400 Received: from mail-yw0-f196.google.com ([209.85.161.196]:35429 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753341AbcJURYy (ORCPT ); Fri, 21 Oct 2016 13:24:54 -0400 MIME-Version: 1.0 In-Reply-To: <20161021171240.6972-1-eric@anholt.net> References: <20161021171240.6972-1-eric@anholt.net> From: Alex Deucher Date: Fri, 21 Oct 2016 13:24:53 -0400 Message-ID: Subject: Re: [PATCH libdrm 1/2] Return an -ENODEV from drmGetDevice() when no device was found. To: Eric Anholt Cc: Maling list - DRI developers , LKML Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 956 Lines: 36 On Fri, Oct 21, 2016 at 1:12 PM, Eric Anholt wrote: > 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 Reviewed-by: Alex Deucher > --- > 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 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel