From patchwork Mon Feb 1 21:11:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 105002 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp320731lbb; Mon, 1 Feb 2016 13:11:20 -0800 (PST) X-Received: by 10.66.185.225 with SMTP id ff1mr41372666pac.97.1454361080733; Mon, 01 Feb 2016 13:11:20 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qw9si26379315pab.126.2016.02.01.13.11.20; Mon, 01 Feb 2016 13:11:20 -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 S932715AbcBAVLR (ORCPT + 30 others); Mon, 1 Feb 2016 16:11:17 -0500 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:58108 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932294AbcBAVLP (ORCPT ); Mon, 1 Feb 2016 16:11:15 -0500 Received: from cpc11-sgyl31-2-0-cust672.sgyl.cable.virginm.net ([94.175.94.161] helo=debutante) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1aQLkd-0003ca-85; Mon, 01 Feb 2016 21:11:11 +0000 Received: from broonie by debutante with local (Exim 4.86) (envelope-from ) id 1aQLka-0002Kw-DQ; Mon, 01 Feb 2016 21:11:08 +0000 From: Mark Brown To: linux-kernel@vger.kernel.org Cc: Mark Brown Date: Mon, 1 Feb 2016 21:11:07 +0000 Message-Id: <1454361067-8943-1-git-send-email-broonie@kernel.org> X-Mailer: git-send-email 2.7.0.rc3 X-SA-Exim-Connect-IP: 94.175.94.161 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on mezzanine.sirena.org.uk X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.2 Subject: [PATCH] regmap: Return an error if a caller attempts to do an unsupported raw read X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/base/regmap/regmap.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.7.0.rc3 diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 343263449aff..e2f68807d970 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,