From patchwork Tue Jan 24 02:24:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 92282 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1508571qgi; Mon, 23 Jan 2017 18:24:29 -0800 (PST) X-Received: by 10.84.216.91 with SMTP id f27mr47789497plj.92.1485224669522; Mon, 23 Jan 2017 18:24:29 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r19si17478001pfe.12.2017.01.23.18.24.29; Mon, 23 Jan 2017 18:24:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751817AbdAXCY1 (ORCPT + 1 other); Mon, 23 Jan 2017 21:24:27 -0500 Received: from mail-pg0-f43.google.com ([74.125.83.43]:33720 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751815AbdAXCY1 (ORCPT ); Mon, 23 Jan 2017 21:24:27 -0500 Received: by mail-pg0-f43.google.com with SMTP id 204so50209893pge.0 for ; Mon, 23 Jan 2017 18:24:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=ZVAmjBu8ZPppFE549yTOvjenaTso6pcY8n/zQIlSmh4=; b=DZqkjl7QRxgNPSWDZwLoLbqUeBDu/zeJt5jzep6Y0OG0NIlwpEnl7Gbn9SPJYoopyI Bf/hwqv9P5JBu2jWqKDQmRJ0BAIlsks74EWsNcLaTkgqDP72raiK65At7tnzytWj8EtN JIzo2nmB0tTVprYHR8qdSbrvp9ldTp/b0Xcvg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZVAmjBu8ZPppFE549yTOvjenaTso6pcY8n/zQIlSmh4=; b=Z63RLgspYbNgSkWrA9DNUbMeSXdwnq81iIJXmcwZalRDLSkzYdIrZSewMySZzQWqTr qcwDaHfzNznIfs4AEhCsSUll2f+vP56egFuENiKo3niVlhaYRB8dZgjvWEIL7iXdo624 d+eXCzcwC+rZOi1EiSuTY0CbsgnHONLOigXGL+JsMEpXbuTNMPOerLCHLhotRCke9gLz 94IebgertTQTC7rSR6CegyMdDakI5zT7bBwkdSXiuGDiSxV1Jy7xsHWtpReJPMnN/oDY BDoVUGwBAWeV7W+fC/mWtGq9T0OXxpj/NHFrsGEn5BxprJioQUu4VkNb0hk+N+0iOomY JevQ== X-Gm-Message-State: AIkVDXJn4Wi+2hz5lx3MTep9jgcGEfzL/XyrEyjoU3C+pgt65G91wOkj0qic0EtgjHj49pC8 X-Received: by 10.99.114.19 with SMTP id n19mr35973935pgc.143.1485224666563; Mon, 23 Jan 2017 18:24:26 -0800 (PST) Received: from localhost.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id t14sm39748575pfk.85.2017.01.23.18.24.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Jan 2017 18:24:25 -0800 (PST) From: Stephen Boyd To: Wolfram Sang Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org Subject: [PATCH] i2c: Fix error print when address is invalid Date: Mon, 23 Jan 2017 18:24:24 -0800 Message-Id: <20170124022424.18212-1-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.10.0.297.gf6727b0 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org When the address is invalid, we print out the address that's in info.addr, but that member of info hasn't been assigned yet. It's assigned in the line after we check the address. This causes the print to show something like i2c i2c-1: of_i2c: invalid addr=0 on ... when we want something like i2c i2c-1: of_i2c: invalid addr=0xaf on ... Just pass addr here, and update the print format to indicate hex as well. Signed-off-by: Stephen Boyd --- drivers/i2c/i2c-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.10.0.297.gf6727b0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index cf9e396d7702..9fec1c232d68 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -1707,8 +1707,8 @@ static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap, } if (i2c_check_addr_validity(addr, info.flags)) { - dev_err(&adap->dev, "of_i2c: invalid addr=%x on %s\n", - info.addr, node->full_name); + dev_err(&adap->dev, "of_i2c: invalid addr=%#x on %s\n", + addr, node->full_name); return ERR_PTR(-EINVAL); }