From patchwork Tue Feb 2 12:16:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 104998 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp691808lbb; Tue, 2 Feb 2016 04:17:08 -0800 (PST) X-Received: by 10.98.32.76 with SMTP id g73mr46592486pfg.48.1454415428093; Tue, 02 Feb 2016 04:17:08 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s1si1649372pfa.149.2016.02.02.04.17.07; Tue, 02 Feb 2016 04:17:08 -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; dkim=pass header.i=@gmail.com; dmarc=pass (p=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755287AbcBBMRF (ORCPT + 30 others); Tue, 2 Feb 2016 07:17:05 -0500 Received: from mail-vk0-f47.google.com ([209.85.213.47]:36828 "EHLO mail-vk0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755172AbcBBMRD (ORCPT ); Tue, 2 Feb 2016 07:17:03 -0500 Received: by mail-vk0-f47.google.com with SMTP id n1so95606952vkb.3 for ; Tue, 02 Feb 2016 04:17:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=iqQkfi0QbDiGXw05E5TaRMuyNyqCep0fFViMjd5tWq4=; b=Z2jwSS9Xrw4jDjTdDn/wkN+5845iPUfjU5Orbj4hVWU8gK3grCT32Z/UFB97l498JA s1HvrbfMZGjG0NLdbfseoX8vbUSr4oEVzVjwf6QR+XkF5+RYBgGb7F3yiL7N7RtJqOJc U70+kzcj8eP7dtRtmY/Fr2ouuZLogkT4We9EaexWligD7twGW2PeM2UcgyWh/nAuV00L BcDRHlWSv5/k4DLw+2Ncyq6lANgmPfCsYsVnsdROztIpDuG3Sj2zOjSiCX/nO9jWuTSZ MwGRZKvli+xFM9RbPpY22NaDQi6UN3lO2hH3IyaEg9PfDaQWHSR5OvTCqfIj42j8keC/ DjDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=iqQkfi0QbDiGXw05E5TaRMuyNyqCep0fFViMjd5tWq4=; b=A8vckCc3UYYgd0mK/nXcK0n/3L4UPnsvHXFkgQxoZwCV26fE5xOTtLULPWLD2ymvJy giRT2eJtz7hH3WJQfHgqAYONAct2vOn9ih6UkpbEt5vfV1E1352OkfjZfd2qjj3hfABm 6L+0bVXD/KS9jEUuKG4RAxjd0U+hMtcriRB4kBdUGqoVuJJL8Gc2Q0MxwGdFOKVruW6K NjsMJfQWxneF7waZQBnaw9reHWAhY1aXhFeB2AwQgIHATKoymAIlym96O1s+XCjQkI+X swE8Sl4r7VaxmRbmhd0LowjXdiRHcqopHXglhAbh88ULxuGNfHih01YZpPUM5aNH0ybn YOMA== X-Gm-Message-State: AG10YOSlB6ED+gVtXqCYYVxKy0RGPxx+Bfj7kGixn5PgogRrbQmSTj5BlwuRDFkV2SnIeQ== X-Received: by 10.31.139.76 with SMTP id n73mr19455086vkd.78.1454415422245; Tue, 02 Feb 2016 04:17:02 -0800 (PST) Received: from localhost.localdomain ([187.180.185.154]) by smtp.gmail.com with ESMTPSA id b6sm406948vkf.5.2016.02.02.04.17.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Feb 2016 04:17:01 -0800 (PST) From: Fabio Estevam To: broonie@kernel.org Cc: mail@maciej.szmigiero.name, linux-kernel@vger.kernel.org, Fabio Estevam Subject: [PATCH 1/2] regmap: Return an error if a caller attempts to do an unsupported raw read Date: Tue, 2 Feb 2016 10:16:50 -0200 Message-Id: <1454415411-14404-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Brown regmaps without raw I/O access can't implement raw I/O operations, return an error if someone tries to do that rather than crashing. Signed-off-by: Mark Brown Signed-off-by: Fabio Estevam --- drivers/base/regmap/regmap.c | 3 +++ 1 file changed, 3 insertions(+) -- 1.9.1 diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 3432634..e2f6880 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -2255,6 +2255,9 @@ static int _regmap_raw_read(struct regmap *map, unsigned int reg, void *val, WARN_ON(!map->bus); + if (!map->bus || !map->bus->read) + return -EINVAL; + range = _regmap_range_lookup(map, reg); if (range) { ret = _regmap_select_page(map, ®, range,