From patchwork Thu Oct 18 20:07:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 10648045 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E6CC1057 for ; Thu, 18 Oct 2018 20:07:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80A7728C53 for ; Thu, 18 Oct 2018 20:07:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7481128DF7; Thu, 18 Oct 2018 20:07:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4120228C53 for ; Thu, 18 Oct 2018 20:07:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A6AA56E0F2; Thu, 18 Oct 2018 20:07:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 738A06E0F2 for ; Thu, 18 Oct 2018 20:07:53 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id l6-v6so34641095wrt.1 for ; Thu, 18 Oct 2018 13:07:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4fL9mkXS5h4GtdfECnbLSirN2mEJ5VDZt/4UDif6kK0=; b=jIRB1wgkGPvVf0ASgMAkVqHoxYyqebqvirdmX/SZp45pbySecDqfQpkrE76v+Mdh7Z N9Wssg4iDxEc2Lm6cGKuqAazoDYV9ix+obpYZNaAsQpno3WLPz1jCbzx3+uxh0wWYqxU n8d/VJAvhJVZrhkHJVMJlXvOYKMAl2uKftKQ1/r+AJW/bHVTSTzQLE3B8o8rTAFfQf32 N8er/PoXLGF1iM1ZjnJY74t19wQdtV3NTJ4xVr9qJognq3f8aTjQnWzIEE83lQcnAslo Qc3sj5+Xk5JsooBzeLn95ls6FZsxXnj0kjzLf7T+npL/uWH7IqoY5GDqhXfLc7/vdDnW Punw== X-Gm-Message-State: ABuFfojUDe2D7Tik+hwHPCzxITl9U1gWrDh90JZWjskfZWSSDb5cgxPu Kmi0Ll0P+oX9qNAY+gRbNrhW9DtQ X-Google-Smtp-Source: ACcGV61tkFqFnDMQsMo2Dx19LJ3hd7IegLncHj62/ER+F5rWY63gb7RQzKgz9WpC0Cf6u1/BcHzYJA== X-Received: by 2002:a5d:5501:: with SMTP id b1-v6mr12697743wrv.228.1539893271913; Thu, 18 Oct 2018 13:07:51 -0700 (PDT) Received: from localhost.localdomain (2a02-8389-4001-7200-e872-03a0-bb8d-7d2e.cable.dynamic.v6.surfer.at. [2a02:8389:4001:7200:e872:3a0:bb8d:7d2e]) by smtp.gmail.com with ESMTPSA id h82-v6sm648663wmf.14.2018.10.18.13.07.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Oct 2018 13:07:50 -0700 (PDT) From: Christian Gmeiner To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm 2/2] xf86drm: handle non existing OF_COMPATIBLE_N uevent entry Date: Thu, 18 Oct 2018 22:07:37 +0200 Message-Id: <20181018200737.5953-3-christian.gmeiner@gmail.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181018200737.5953-1-christian.gmeiner@gmail.com> References: <20181018200737.5953-1-christian.gmeiner@gmail.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emil.l.velikov@gmail.com, lukas@mntmn.com MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Default the count value to 0. Signed-off-by: Christian Gmeiner --- xf86drm.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/xf86drm.c b/xf86drm.c index 4ee1337b..a9152f0c 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -3537,17 +3537,16 @@ static int drmParsePlatformDeviceInfo(int maj, int min, { #ifdef __linux__ char path[PATH_MAX + 1], *value; - unsigned int count, i; + unsigned int count = 0, i; int err; snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device", maj, min); value = sysfs_uevent_get(path, "OF_COMPATIBLE_N"); - if (!value) - return -ENOENT; - - sscanf(value, "%u", &count); - free(value); + if (value) { + sscanf(value, "%u", &count); + free(value); + } info->compatible = calloc(count + 1, sizeof(*info->compatible)); if (!info->compatible)