From patchwork Thu Apr 3 07:53:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3931761 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8F0659F334 for ; Thu, 3 Apr 2014 07:54:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9F4F9201E4 for ; Thu, 3 Apr 2014 07:54:08 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 7103520149 for ; Thu, 3 Apr 2014 07:54:07 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 59DAB26559B; Thu, 3 Apr 2014 09:54:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 4304A265558; Thu, 3 Apr 2014 09:53:53 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id EB1F6265560; Thu, 3 Apr 2014 09:53:51 +0200 (CEST) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by alsa0.perex.cz (Postfix) with ESMTP id 9C1F8265549 for ; Thu, 3 Apr 2014 09:53:43 +0200 (CEST) Received: by mail-pa0-f42.google.com with SMTP id fb1so1462660pad.29 for ; Thu, 03 Apr 2014 00:53:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=3XFy7aaCWqFJE1t4wSGaBVRGosm0Fah9/KjX7nqpfnY=; b=AVGRABxfiPqGyxAja2ctksU8MOyICXaDIEPMdJHHsOP7PWWCuMmD7ddK9lEtKhToiy QtMKgBHSWxA3mQq/ujAIP3/7qeOkkVjBOHR2VNORI4XCQ/PaqodeUgnXXCZHsd3LLIKA oFA5Lhs9OIOZeHrDYZn2a+B/uMK5UYsXJLuTcjcKUwnLYnPN+LB/8fShIjGQTs37ZHo/ id9/DvfLFOs05WczC3Hyy7GBCA5FeRKJ/f7pwcqX0QBMQBtiXcZ2I2BF8vs5cw8Xew0D wCUcX0KguljNy/pePaPLTjOiO5kC/weWvLbBjOQkC4Mut00gfSS2gEHkA6sEN2a+Cvin /kJg== X-Gm-Message-State: ALoCoQnJmVhBL81ebksnme+qtPzKRuQuFErrYsV/u5ZsGd3DyxAGj3vfa9w7/nWl2e4p1dhMlwya X-Received: by 10.68.163.100 with SMTP id yh4mr5698919pbb.122.1396511621944; Thu, 03 Apr 2014 00:53:41 -0700 (PDT) Received: from [192.168.0.102] (36-237-254-66.dynamic-ip.hinet.net. [36.237.254.66]) by mx.google.com with ESMTPSA id bz4sm9310568pbb.12.2014.04.03.00.53.39 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 03 Apr 2014 00:53:41 -0700 (PDT) Message-ID: <1396511616.30532.2.camel@phoenix> From: Axel Lin To: Mark Brown Date: Thu, 03 Apr 2014 15:53:36 +0800 X-Mailer: Evolution 3.8.4-0ubuntu1 Mime-Version: 1.0 Cc: Brian Austin , alsa-devel@alsa-project.org, Liam Girdwood , Paul Handrigan , Nicolin Chen Subject: [alsa-devel] [PATCH] ASoC: cs42xx8: Check return value of regmap_read and report correct chipid value X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Fix checking return value of regmap_read(). Also fix reporting the chip_id value. CS42XX8_CHIPID_CHIP_ID_MASK is 0xF0, so the chip_id value is (val & CS42XX8_CHIPID_CHIP_ID_MASK) >> 4). Signed-off-by: Axel Lin Acked-by: Paul Handrigan Acked-by: Brian Austin --- sound/soc/codecs/cs42xx8.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/cs42xx8.c b/sound/soc/codecs/cs42xx8.c index 082299a..b1606cf 100644 --- a/sound/soc/codecs/cs42xx8.c +++ b/sound/soc/codecs/cs42xx8.c @@ -495,17 +495,16 @@ int cs42xx8_probe(struct device *dev, struct regmap *regmap) regcache_cache_bypass(cs42xx8->regmap, true); /* Validate the chip ID */ - regmap_read(cs42xx8->regmap, CS42XX8_CHIPID, &val); - if (val < 0) { + ret = regmap_read(cs42xx8->regmap, CS42XX8_CHIPID, &val); + if (ret < 0) { dev_err(dev, "failed to get device ID: %x", val); - ret = -EINVAL; goto err_enable; } /* The top four bits of the chip ID should be 0000 */ - if ((val & CS42XX8_CHIPID_CHIP_ID_MASK) != 0x00) { + if (((val & CS42XX8_CHIPID_CHIP_ID_MASK) >> 4) != 0x00) { dev_err(dev, "unmatched chip ID: %d\n", - val & CS42XX8_CHIPID_CHIP_ID_MASK); + (val & CS42XX8_CHIPID_CHIP_ID_MASK) >> 4); ret = -EINVAL; goto err_enable; }