From patchwork Thu Mar 14 16:55:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 160363 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp15737664jad; Thu, 14 Mar 2019 09:55:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNWunUqX0bendgbTm+a5zlflq1ypNxHaUtWz6l0WubA9wYpBjgmHlJoA0AY9yOf1Nyf6/S X-Received: by 2002:a17:902:8ec1:: with SMTP id x1mr53004413plo.52.1552582533510; Thu, 14 Mar 2019 09:55:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552582533; cv=none; d=google.com; s=arc-20160816; b=is7mq6SSDDbXw7xpgdcaIARul50Hlv8QHrrZzaMD67QILM+g/4cWoc1pTLUSucFd4w U7qra6vxfujEp6jdNnr/kMdk1PKs21VpNUtpuyqrh35xTm51iTnFCpOGJpCLZqztJdUE Cy/FHTlfXVzR1aymhAFsSLKzXnLgaAnO2eF2QhiR5vW/YKsV+sBT0a9NMlYB/lJTN4DL KAISuyGXux/3WyoNm8ou5gfRMbo9cLu1x+Etsx7po76oO5/ojAl9qrZx+Y7ny72Zww5Q C0aTM/FZd7fe22ZB/5rZUmXRniOIZ0bod67X/Wzj3A4FOQ86/WgpQxgEFDA0QzxPOhtU uYVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=64qGEB53pRWVWyNdTvFq+lsPpbFyZD5C2ijbHaKNPxE=; b=04LmdCyqSU1PtO6BvihptwAeIEUukExZoYvksWBanLKuUAnj2aXyKonEKqYo9cV1zl UPVu5dG+JczWlUmvRp9wceiqvNjh9PZvvEXGHClMnKchPgg0MjkKNDTYV5hAzEvAU+9U QpEw3gpbASWFgzCRJCyrEM5o6rCs/FMA8pty+LeEUYi80Ufm6kHRkRueMvfeaEIdbJ1k Y6QgBZX8n5JBQ6gg0omfr8lxSxe4GWGtTBTlg0ByBIj8+wlHzCRQsADl1Hycnnk4U2Ix J2hTo2Z9es8Frbz9jE3EF4FDdzl3QLkOpQRXlsSLH4vuF0aQPI8G4mBvu36Xnuy0mGIP qr+w== 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 70si14372218pla.128.2019.03.14.09.55.32; Thu, 14 Mar 2019 09:55:33 -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 S1727663AbfCNQzb (ORCPT + 31 others); Thu, 14 Mar 2019 12:55:31 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5247 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726737AbfCNQz0 (ORCPT ); Thu, 14 Mar 2019 12:55:26 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id AADDAB8322CF9B5AA775; Fri, 15 Mar 2019 00:55:22 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.408.0; Fri, 15 Mar 2019 00:55:14 +0800 From: John Garry To: , , , , , , CC: , , , , , John Garry Subject: [RFC PATCH 2/2] hwmon: (f71805f): Use request_region() in f71805f_init() Date: Fri, 15 Mar 2019 00:55:16 +0800 Message-ID: <1552582516-70855-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1552582516-70855-1-git-send-email-john.garry@huawei.com> References: <1552582516-70855-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently the driver does not call request_region() prior to accessing IO port regions in f71805f_init(), so add it. Signed-off-by: John Garry --- drivers/hwmon/f71805f.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c index 73c681162653..910082c7f184 100644 --- a/drivers/hwmon/f71805f.c +++ b/drivers/hwmon/f71805f.c @@ -1617,10 +1617,21 @@ static int __init f71805f_init(void) int err; unsigned short address; struct f71805f_sio_data sio_data; + struct resource *res; + size_t size = 0x4e - 0x2e + SIO_REG_ADDR + 4; + + /* Request the whole 0x2e - 0x4e region */ + res = request_region(0x2e, size, "f71805f"); + if (!res) + return -EBUSY; if (f71805f_find(0x2e, &address, &sio_data) - && f71805f_find(0x4e, &address, &sio_data)) + && f71805f_find(0x4e, &address, &sio_data)) { + release_region(0x2e, size); return -ENODEV; + } + + release_region(0x2e, size); err = platform_driver_register(&f71805f_driver); if (err)