Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1887281ybl; Sat, 25 Jan 2020 11:01:44 -0800 (PST) X-Google-Smtp-Source: APXvYqwwEXQbOAf7angKTC668A1zYjvDfwPiaM7gGx4N58XwkHcLS/hHMpIqSRRCjpsQvh8kGsxq X-Received: by 2002:a9d:5d12:: with SMTP id b18mr1850143oti.305.1579978904704; Sat, 25 Jan 2020 11:01:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579978904; cv=none; d=google.com; s=arc-20160816; b=bqAiHk5oCOGQ/Aiv30zUbvXAmF/5CYNUaiNhSQXz9ytua9WpyeJzZ1+RkwqJI0llxd 6m9Kf/Srpdki58w1Qr6bzXP8zlDAOhV6NbxMp2kSEO8y5xTMHkJDh8GFlr1nuCaOS1cT Lg+W2zZmOF7C4pXhKdZsIdIWkfyoZS/TtEwvC9bX2deo6ltd+O0PIfq8bd71VbEjcxsX AleU95aUULsTHrtwD5B1NYJ7xnGnX7MCGEZxVSuRW9i4nJ9XolhMyH1G7NclTS2PqDxD 934yNs4box197VY/h0LldQqOmJRZ0M1r6u4LGJMx42keC83l3g5Ec+lYsycJ2UQ7rpdi /HDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Mlu+ldSyGyNjl+j3bWZhMNcGtKuYQOYA685+YfyDiaQ=; b=Ha23yu3snAQyStqT6wBj6IiBN8EH3XjIWkBxGoI3+7GkHcqPP9lGsg2Byyx6BfzlGZ EXISUhoCcxlJWEeZ5nWT+Ji9l11wvDhl7Z7bqbOUIrSgcS5cMrX513IHytIVJoOsh9i1 PWIFOiUlwS7FXIRwMuQsKlOoGpFK5yTTuYtMSa41iHwSMCRuWDlKC6ftF44Y2hnPRkgE okoiHRoSshMUVwqZuPjytG/fRPT/biQxEBbwHN1Ra1XDlMYrepMPsAGOxbmBE9nU7PuC 97joPP4R5XCM4Ob6sN+VKYR9Sio2VftjBP/XHd3qTUC8RcjJ0KL47fKAEiyKgbs9F7GH GlAw== 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 y20si4972518otq.190.2020.01.25.11.01.19; Sat, 25 Jan 2020 11:01:44 -0800 (PST) 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 S1726703AbgAYS7i (ORCPT + 99 others); Sat, 25 Jan 2020 13:59:38 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:44582 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726282AbgAYS7i (ORCPT ); Sat, 25 Jan 2020 13:59:38 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id F35CA1C213B; Sat, 25 Jan 2020 19:59:36 +0100 (CET) Date: Sat, 25 Jan 2020 19:59:36 +0100 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Guenter Roeck , Sasha Levin Subject: Re: [PATCH 4.19 309/639] hwmon: (w83627hf) Use request_muxed_region for Super-IO accesses Message-ID: <20200125185935.GF14064@duo.ucw.cz> References: <20200124093047.008739095@linuxfoundation.org> <20200124093125.642179022@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="eDB11BtaWSyaBkpc" Content-Disposition: inline In-Reply-To: <20200124093125.642179022@linuxfoundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --eDB11BtaWSyaBkpc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > [ Upstream commit e95fd518d05bfc087da6fcdea4900a57cfb083bd ] >=20 > Super-IO accesses may fail on a system with no or unmapped LPC bus. >=20 > Also, other drivers may attempt to access the LPC bus at the same time, > resulting in undefined behavior. >=20 > Use request_muxed_region() to ensure that IO access on the requested > address space is supported, and to ensure that access by multiple drivers > is synchronized. >=20 > @@ -1644,9 +1654,21 @@ static int w83627thf_read_gpio5(struct platform_de= vice *pdev) > struct w83627hf_sio_data *sio_data =3D dev_get_platdata(&pdev->dev); > int res =3D 0xff, sel; > =20 > - superio_enter(sio_data); > + if (superio_enter(sio_data)) { > + /* > + * Some other driver reserved the address space for itself. > + * We don't want to fail driver instantiation because of that, > + * so display a warning and keep going. > + */ > + dev_warn(&pdev->dev, > + "Can not read VID data: Failed to enable SuperIO access\n"); > + return res; > + } > + > superio_select(sio_data, W83627HF_LD_GPIO5); > =20 > + res =3D 0xff; > + This is strange. res is not actually assigned in the code above, so we have res =3D 0xff twice. Can we remove one of the initializations and do 'return 0xff' directly to make code more clear? > @@ -1677,7 +1699,17 @@ static int w83687thf_read_vid(struct platform_devi= ce *pdev) > struct w83627hf_sio_data *sio_data =3D dev_get_platdata(&pdev->dev); > int res =3D 0xff; > =20 > - superio_enter(sio_data); > + if (superio_enter(sio_data)) { > + /* > + * Some other driver reserved the address space for itself. > + * We don't want to fail driver instantiation because of that, > + * so display a warning and keep going. > + */ > + dev_warn(&pdev->dev, > + "Can not read VID data: Failed to enable SuperIO access\n"); > + return res; > + } Direct "return 0xff" would make more sense here, too. Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --eDB11BtaWSyaBkpc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCXiyQFwAKCRAw5/Bqldv6 8nvzAKC6CLvLaAD0Gk1Ci7ONd1tOIdOZzgCgw5Kh9Iidg+Iq18YwHCXBrzydIiw= =kkYO -----END PGP SIGNATURE----- --eDB11BtaWSyaBkpc--