From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CBD5C433ED for ; Sat, 15 May 2021 05:29:23 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9ADF0613F7 for ; Sat, 15 May 2021 05:29:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9ADF0613F7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Fhv8d39rmz3dw2 for ; Sat, 15 May 2021 15:29:21 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=209.85.208.41; helo=mail-ed1-f41.google.com; envelope-from=kswilczynski@gmail.com; receiver=) Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Fhv3T0vgdz3063 for ; Sat, 15 May 2021 15:24:52 +1000 (AEST) Received: by mail-ed1-f41.google.com with SMTP id i13so838927edb.9 for ; Fri, 14 May 2021 22:24:52 -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:mime-version:content-transfer-encoding; bh=l65J0VP8+dF+CzFmmf34XzBwKUAccEC4aN+sTYjEOtI=; b=KvxLsIIaWi0Jqn/6MKy8ZNgtOOny90lx1EnsVjhrYmTqhJJoO/embesJn/AFCV5kR2 3bf29MFqan8qwAbD7+TS7ncBGbGqaoxl3WPSa9OrxkMNG4BoyeSg8h5V6zlQQXA0+25r IGZiOBNSOds9UfwYR9XARm/pZUgwNQoVNrTuT5oDHpwpwC6PhSz0TYebttO3zXmRw5s6 /+5oUZr6YNjpgH5qxqx3k2kpHbjLFoCwXCPszwodBsVw0ef+usKrJ069PqM5WDfor/je TXMBFEPee8LOhcbivnvoIKjIMGUBfMrPkTStCRA/Rdm+MWC2xgjrgp6u6b+d90+vvLM/ ynYQ== X-Gm-Message-State: AOAM531lJaBZwb57EHT7+PzcUGnW0j0a/gnLGLKJvac0wtAaQTsvTnvN azMrw3RNx8ChGApHd/DQugs= X-Google-Smtp-Source: ABdhPJxKOWt67s3c4arbmA4eCFVxbLX2nJU5TzBTB1JhkMEU3nW9uORpfOz85iSHSHEdXWViuNcVeA== X-Received: by 2002:a50:fc0b:: with SMTP id i11mr61231380edr.259.1621056289994; Fri, 14 May 2021 22:24:49 -0700 (PDT) Received: from workstation.lan ([95.155.85.46]) by smtp.gmail.com with ESMTPSA id kt21sm4821487ejb.5.2021.05.14.22.24.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 22:24:49 -0700 (PDT) From: =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= To: Bjorn Helgaas Subject: [PATCH v2 14/14] PCI/sysfs: Only show value when driver_override is not NULL Date: Sat, 15 May 2021 05:24:34 +0000 Message-Id: <20210515052434.1413236-14-kw@linux.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210515052434.1413236-1-kw@linux.com> References: <20210515052434.1413236-1-kw@linux.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tyrel Datwyler , linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Vidya Sagar , Oliver O'Halloran , Joe Perches , Paul Mackerras , Kurt Schwemmer , Logan Gunthorpe , Xiongfeng Wang Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Only expose the value of the "driver_override" variable through the corresponding sysfs object when a value is actually set. Signed-off-by: Krzysztof WilczyƄski --- drivers/pci/pci-sysfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 5d63df7c1820..4e9f582ca10f 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -580,10 +580,11 @@ static ssize_t driver_override_show(struct device *dev, struct device_attribute *attr, char *buf) { struct pci_dev *pdev = to_pci_dev(dev); - ssize_t len; + ssize_t len = 0; device_lock(dev); - len = sysfs_emit(buf, "%s\n", pdev->driver_override); + if (pdev->driver_override) + len = sysfs_emit(buf, "%s\n", pdev->driver_override); device_unlock(dev); return len; } -- 2.31.1