Received: by 10.213.65.68 with SMTP id h4csp1541540imn; Sun, 8 Apr 2018 06:03:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx49J9TZVELGxL63d40ExgT/nudZYC49KXgqpK8AMCY/nRi6qOQtMTrBscG7PtoDeu+/VIZUA X-Received: by 2002:a17:902:a9c2:: with SMTP id b2-v6mr762728plr.181.1523192593114; Sun, 08 Apr 2018 06:03:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523192593; cv=none; d=google.com; s=arc-20160816; b=XukYkozJQjRB3x71hI+QLgrYIllywxggFCOd6vWV/jux448AliEIzNsyYr3bW2odTH cefEMvsVwNZhFK9Zz5D+aAObyy4mqClSHgPow+8DKjIaAUMC9JsJk++9vcSRsSbWIaP1 E55y2MCmomoIKvd2n3eKnI0Go2AVlyCfo8GnY53NFjGokIinRjFXFHEoK0MWsg8p0qWL zBUQwITkfva17jMUKCoMrmP8XamLDpYgbQNBlFJ6q30PwpXz094KtjRILjrp4vc8yI2v 1n652yhhNagejOxl00SplQzJnM3fMTKt4Z4e0Hvakqwtfq/H9b4RwdaipMrwioBJE4rP HoAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:importance:content-transfer-encoding :mime-version:subject:references:in-reply-to:message-id:cc:to:from :date:arc-authentication-results; bh=9Lv1p411O3MMr0CzuOXtk339zdqyFCPVwD9WQy1UIq8=; b=UCrp3s5A8E8ZK+YrdMjvCs5ZNN1tjz0Tfu0FIwME+B/abYhRziwQTHTkf6fk+4hxGH b5Vw/KPdyJax8xBZXayUk06WqJoDty9R+U3mvt99OdhhGvf2pkGIp312UR++fYqupWA5 2CTgUjfFgbR8o80OwjP16bM6UxpmL5CAIgGYSz+CXXemi20IUmkeKyB+O0/dkzLH0e2M cNWDWdto2F+ggFgBwDypqCczAMelKmMApjN7s78r7mQ/iPftpN66xpVVAQF7DE1WAHKB Q+FVm2UFM4v5bdUHEAlKoXkzYWYyS/8O8VPZa9BzFw/2eiWtRGS0a2PPA9Z9c9m+LNTw oDfQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h65si1148076pgc.417.2018.04.08.06.02.36; Sun, 08 Apr 2018 06:03:12 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751967AbeDHL2f convert rfc822-to-8bit (ORCPT + 99 others); Sun, 8 Apr 2018 07:28:35 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:44681 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751862AbeDHL2e (ORCPT ); Sun, 8 Apr 2018 07:28:34 -0400 Received: from null ([172.19.249.19]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.167]) with ESMTPSA (Nemesis) id 0MfvaW-1eswjK2fmW-00N9Ej; Sun, 08 Apr 2018 13:28:06 +0200 Date: Sun, 8 Apr 2018 13:28:04 +0200 (CEST) From: Stefan Wahren To: Scott Branden , Florian Fainelli , Eric Anholt , Greg Kroah-Hartman , Geert Uytterhoeven , bcm-kernel-feedback-list@broadcom.com, Ray Jui , Dave Stevenson , phil@raspberrypi.org Cc: Arnd Bergmann , linux-rpi-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Message-ID: <2047337098.98106.1523186884813@email.1und1.de> In-Reply-To: <1523178315-30562-1-git-send-email-geert@linux-m68k.org> References: <1523178315-30562-1-git-send-email-geert@linux-m68k.org> Subject: Re: [PATCH/RFC] soc: bcm2835: Make !RASPBERRYPI_FIRMWARE dummies return failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.8.4-Rev22 X-Originating-Client: open-xchange-appsuite X-Provags-ID: V03:K1:xxB1SbtqIrBEmGVLl5/LrRcV4SwoOHH63deXNlflL69lxDUYbLB Uoj5mVcda7Y2dI3M4ChzQKILc4Xsn+mnYtYBrfZJR6LkifoHehMKKlpcHmCfGy81InbVMSB Fa52BzxIIlchmJx7ExWvgctAx6g44SEnBkiMnJboQqPABOYKxP/PbETAvkKe7BE9Fkb+5GM zMU739VjQ1gb5q90J6/Iw== X-UI-Out-Filterresults: notjunk:1;V01:K0:hFG2G3BXAF4=:7eA/GqjwKOSRX6JW8N7Ggh spgtAISX9gm/jVSpefuFMw+xxrkp8qJ04xhf9wy6YG8Yu5TEPDKkqTUFXTJwqihll3PTitBML wxoIed0UhTzy5feVzRuFZjCrzqA++jTDKCFVL0Nn17WtLdY2hxpwA5kjhu2k8LViDA3tL/43T 4iNXN0HqQoxOZp+SkataSYtwZ2ZOqNeTIlWY6hrKhZ4E4e8b1flY1gf/JigtboKfjHqoTyt7r 5Qo4GsaurxWp5IC22IpH+qdeoSoGfwftA/pw39AGtt/oXNWd4HeSIf7cjkv4MhpK7TCIZxYS/ xxS3uVOjZTOb7KR+TTqmT824uXE03jffF98nsdUvHAxJuPDpO8clvvgBt8DcyG0oKAlh7fAfB wFRBys7+8exavaJjTOxHGO59XlX7offBFUvUM+fu1a2GnuidtOvRXD0ByCCRJ9YHihTOnR+9X RWN6RYWWQhbvi8RFaW4cxbM3vrYYAb/DZYwYYUfL2C6bvc2eVi26neEkDFXGkrpN4tsO3hAP1 diCSjf/LMd7ecqvp/icp4nErkp4Y1T+YbrvWpFS6VpGuzwsivBK6Ilm1dHUKQaqdOatI+N8jg DW+HGItzWe+/5udT1z8e2nTRXXPmXjX38CT9VYrztU200S5Avae7TUmMJCK802HgQ/RoPCqyY jmdk8ntuEH66qYHJYh8AcnX8svGj2sCMwUWnwHXVZW16N/XKipL5qeWpxN2NRnsPEGaUm8eHY mIQ1fOksKVKXFY1K6dHpQDLiau2CUwE36qskkzz7CJm/fsrfWa7e8bH5YfU= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Geert, [add Phil] > Geert Uytterhoeven hat am 8. April 2018 um 11:05 geschrieben: > > > If CONFIG_RASPBERRYPI_FIRMWARE=n: > > drivers/gpio/gpio-raspberrypi-exp.c: In function ‘rpi_exp_gpio_get_polarity’: > drivers/gpio/gpio-raspberrypi-exp.c:71: warning: ‘get.polarity’ is used uninitialized in this function > drivers/gpio/gpio-raspberrypi-exp.c: In function ‘rpi_exp_gpio_get_direction’: > drivers/gpio/gpio-raspberrypi-exp.c:150: warning: ‘get.direction’ is used uninitialized in this function > > The dummy firmware interface functions return 0, which means success, > causing subsequent code to make use of the never initialized output > parameter. i think this is more theoritical, because we need to get rpi_firmware first and in this case it's NULL. > > Fix this by making the dummy functions return an error code (-ENOSYS) > instead. Anyway i'm okay with the change. > > Note that this assumes the firmware always fills in the requested data > in the CONFIG_RASPBERRYPI_FIRMWARE=y case. Unfortunately i don't know. > > Fixes: d45f1a563b92dac7 ("staging: vc04_services: fix up rpi firmware functions") > Signed-off-by: Geert Uytterhoeven > --- > Should get.polarity resp. get.direction be preinitialized instead, > like is done for get.state? > > static int rpi_exp_gpio_get(struct gpio_chip *gc, unsigned int off) > { > ... > get.state = 0; /* storage for returned value */ > > ret = rpi_firmware_property(gpio->fw, RPI_FIRMWARE_GET_GPIO_STATE, > &get, sizeof(get)); > ... > } > > This would avoid returning uninitialized data if the firmware did not > fill in the requested data. > --- > include/soc/bcm2835/raspberrypi-firmware.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h > index 50df5b28d2c9df6e..8ee8991aa099af3a 100644 > --- a/include/soc/bcm2835/raspberrypi-firmware.h > +++ b/include/soc/bcm2835/raspberrypi-firmware.h > @@ -143,13 +143,13 @@ struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node); > static inline int rpi_firmware_property(struct rpi_firmware *fw, u32 tag, > void *data, size_t len) > { > - return 0; > + return -ENOSYS; > } > > static inline int rpi_firmware_property_list(struct rpi_firmware *fw, > void *data, size_t tag_size) > { > - return 0; > + return -ENOSYS; > } > > static inline struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node) > -- > 2.7.4 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel