From patchwork Thu Oct 12 19:59:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 115674 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2321236qgn; Thu, 12 Oct 2017 13:03:38 -0700 (PDT) X-Received: by 10.98.71.20 with SMTP id u20mr3067478pfa.23.1507838617941; Thu, 12 Oct 2017 13:03:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507838617; cv=none; d=google.com; s=arc-20160816; b=wlbyPPjTKid0sKMEjs6XJ5mqWfdbUSZxP1+Qtfp0dlCgjYs694Pli0/1SaRLUswKRY f4EG32b5z/ambkkNuWxzXzxQ9kssHZO/dff6SkWWBQk4Jx+bHwEUMW1wZgtMN1wy7QPa LvBm9mRsEOO2erK3sVnXZhti+dnsnYFv7p5r1Q04LU1kq3daDmL20akqE2MMpKCoYlFV 7Nr0e9YqFFF7AH++QEVlxVVINSvuy3fw/D1YhYvv0L/2Xvkkj3DZBkQ3uh9SDM3fAyJb wP68WBFsIx3Hl/IZfd9+rkAbvFyph4CrK10sKPQ1tBzR1D3phrkmNgOVGt5AR/C47d8B r+sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=c0vsHhh/NG3rLPgnNq5E/xUYGiOyY51nELGWvuE3IIM=; b=0rUJ4HlrfTNqHX01fj/iAgvmZZ0mD8mOQHmb/UHFki9lmDJ83PwUS0avisJ28k6ay5 fYIlAK9sQyMN82CLEf4qgpGirWPEpemivDNNVkvAuwk1dpERr03rrN6NwBGawDDTNLxX PTZANGRcix07tolUEiVIINb3ZKb82d0Zzf8jH6es+MzbVbFvK27yf0bV4aQ2r45CyxQ9 xEN2nFBBkM+2ExKqsgHdGX2VyXTk+WnIqSFftR7FbnQTKzmwmNgLDOknPW+gmtvwXXAW 7G066oQM30Cpr3WivneBxs9BdazBK94wBJ08rKGhEBXCDUQQMdJKPVKrBnPhv/gRmc/O 6Kwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dsMdwzXT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f124si11770699pgc.694.2017.10.12.13.03.37; Thu, 12 Oct 2017 13:03:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dsMdwzXT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753131AbdJLUDf (ORCPT + 27 others); Thu, 12 Oct 2017 16:03:35 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:50024 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752246AbdJLUDe (ORCPT ); Thu, 12 Oct 2017 16:03:34 -0400 Received: by mail-wm0-f46.google.com with SMTP id b189so15983939wmd.4 for ; Thu, 12 Oct 2017 13:03:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=c0vsHhh/NG3rLPgnNq5E/xUYGiOyY51nELGWvuE3IIM=; b=dsMdwzXTwkL1St7+S1ElFi0tM0VE1X0lOPQO02wtKHkFI8oofYHEaivYB/FSxZp87l MZ9o0E1qgTAqJELc4E4YXzSrKx3Z2yiY1xWLFPW0byHQROvpVqtyyM2N8trVGgfF5u0N MtaCLloKwRfU7IO9ujknZBUgs+OVSVzcBsMRw= 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; bh=c0vsHhh/NG3rLPgnNq5E/xUYGiOyY51nELGWvuE3IIM=; b=WiAyjX7XZ9iCiD8sOn0sSJR7sn5i7G8wAtk7YdaGrGYIq+8Y0y2DghU8FVMH4njQ7q 5A62xl4BMlXTGqOFPn9mo1SazRb5YZ4K/BbtmlryzIBUTTSECUIctHkkw9+gsugKjRMC bPLh9cbS1vPy0+WDDQtmAthYAsxJt5Sx1I73PVkAtuMDTjr9/ELpZiNy4+GsWpA9MYvZ yhn4jXyftlyO4ldNkMxUqrxCX/l4m/VDdroLJvaURoDMW4uebyR4s2VsnbgdoikjkaAs +4VEBI8J1jCGVsQlHNOg/2QpL2GOSMDRSMovHhau3Po/N+oJFjY9HmWEF8cR/QbSfyoX wrQg== X-Gm-Message-State: AMCzsaVE7DZMmDF2HnWEbUswWy3wnLNQTS6KsJ1FUDGd2pWDAG2ZgKHG fqzqN++C6mKjsdXimn7M2HR5WV9YdQw= X-Google-Smtp-Source: AOwi7QArFoKplUF/QUcGt85FFcG2V9lrd4R9DSFxR0pFHR/85u6ju6oku7cs/8beFjETTMJ3fI9nEw== X-Received: by 10.28.97.194 with SMTP id v185mr2951967wmb.117.1507838613101; Thu, 12 Oct 2017 13:03:33 -0700 (PDT) Received: from localhost.localdomain ([196.78.24.219]) by smtp.gmail.com with ESMTPSA id l80sm1104067wmb.2.2017.10.12.13.03.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Oct 2017 13:03:32 -0700 (PDT) From: Ard Biesheuvel To: linux-kernel@vger.kernel.org, jdelvare@suse.com Cc: Ard Biesheuvel Subject: [PATCH] firmware: dmi: handle missing DMI data gracefully Date: Thu, 12 Oct 2017 20:59:37 +0100 Message-Id: <20171012195937.24817-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, when booting a kernel with DMI support on a platform that has no DMI tables, the following output is emitted into the kernel log: [ 0.128818] DMI not present or invalid. ... [ 1.306659] dmi: Firmware registration failed. ... [ 2.908681] dmi-sysfs: dmi entry is absent. The first one is a pr_info(), but the subsequent ones are pr_err()s that complain about a condition that is not really an error to begin with. So let's clean this up, and give up silently if dma_available is not set. Signed-off-by: Ard Biesheuvel --- drivers/firmware/dmi-sysfs.c | 3 +++ drivers/firmware/dmi_scan.c | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) -- 2.11.0 diff --git a/drivers/firmware/dmi-sysfs.c b/drivers/firmware/dmi-sysfs.c index d5de6ee8466d..3a264cbbb5a6 100644 --- a/drivers/firmware/dmi-sysfs.c +++ b/drivers/firmware/dmi-sysfs.c @@ -651,6 +651,9 @@ static int __init dmi_sysfs_init(void) int error; int val; + if (!dmi_available) + return 0; + if (!dmi_kobj) { pr_err("dmi-sysfs: dmi entry is absent.\n"); error = -ENODATA; diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 783041964439..17a7425063c2 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -715,10 +715,8 @@ static int __init dmi_init(void) u8 *dmi_table; int ret = -ENOMEM; - if (!dmi_available) { - ret = -ENODATA; - goto err; - } + if (!dmi_available) + return 0; /* * Set up dmi directory at /sys/firmware/dmi. This entry should stay