From patchwork Thu Jun 28 13:07:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 140440 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2165719ljj; Thu, 28 Jun 2018 06:07:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJEw1piESjmzUOvweh8TgqmbS2x7FgmekMKePGZEQ2nL7bB/zkpRflblZfG6/5EnONxpr01 X-Received: by 2002:a17:902:43a4:: with SMTP id j33-v6mr10497671pld.118.1530191266538; Thu, 28 Jun 2018 06:07:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530191266; cv=none; d=google.com; s=arc-20160816; b=iNaBf+OYXxr6o23YIiQA1W9n2j6+gnE7EP8xlj9plXE2uUp/f68uklFmF/DQr6e2f5 CcaYiEVz2BwFMdQnN+BvkqQBcqPqXldj5DsxwDw1qQmkkX4egOGwJuk7DdRZnJFjUcgV eqdlzFjrFslxIzCvHgo4DEXqjfdmmIBFDZsVYYx8SaBKrEM2GZo5n33VPJCOV7xnTnZg 2LFafCkEC4b65My5BVsgXFa0SAoTdGlohm6g/zXfOxB5VZJfaFcdaHKH4WUNseL2thkk gvTcZS+nvRVlCCOl4dcGZHQJVi/frgR7/e+BxDW3sUu1P7fOG6I7kQ/Q23HYbHPGZBlZ yt3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=se/vxmp7nkVG7uhxmaj52atkM34NStXapZjQpW93EF0=; b=hbZz7bpDclISRPjTdUWn4s4ubY5z/dnP5i29w6LsR3aR6hl6sqbJIpzfdR4VM7aDxM GXMnbCaukYWaEDz0PBJlxT3By5BcufdDaR8nHjgAGBuLxWoNZrXLsZtuq0x8ujm2Ei/z hfUYaVrDMvzcLzBgHiwQTUWtHhfvMz6+akS2eYLNBTBFSsb1CAwF9WDAWFyxNYefqCUA VJq4cRl5u7NQu5PYTc3Doy44wWTiQCmJBYYSydYDeFBR8iGEXWYqzPadKGrsmV86mYKX 0tP0TeWHIw22cn4lGA24olZCNrYIU9e/bG1GEv6D8WlTsX6JeY2UAs+dt6CxUUfxsG6C 1OeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W3JTLi87; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9-v6si6556676plo.206.2018.06.28.06.07.46; Thu, 28 Jun 2018 06:07:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W3JTLi87; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964849AbeF1NHm (ORCPT + 1 other); Thu, 28 Jun 2018 09:07:42 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:43889 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965245AbeF1NHl (ORCPT ); Thu, 28 Jun 2018 09:07:41 -0400 Received: by mail-lj1-f194.google.com with SMTP id h2-v6so1216423ljb.10 for ; Thu, 28 Jun 2018 06:07:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=se/vxmp7nkVG7uhxmaj52atkM34NStXapZjQpW93EF0=; b=W3JTLi87U82S5euM/Bv2KNdqrHnrkej7clgWZUAq8fLf7/a+U48jOLqxM6wDWZEaGV fpg8vQGcwVa5XG74yzW8yl44MZP9Zio35hzB6UHX7x3+etdmcypnjp9HcDhVgPE0svjW vRDACK5L5SB2Hzv3dJczzdcfwsEf4YU7b8xp8= 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:in-reply-to :references; bh=se/vxmp7nkVG7uhxmaj52atkM34NStXapZjQpW93EF0=; b=GVqVa+QnY0AhyYAGGZmB8gCXjBhmf69gI/20x4Xb8gBUTUoNv3tqKEgr5bH3aE6BjJ bFZecusBe6UY7OXvpHUkGBW7B+7jb4Kt8c8fPJI4yqBGpKbiULqRFfRTYUrS2huWVaY6 N3qFbp35uicXE4nQ/DyIBgXuFWHh3RzpRcBmrS45KoE6a14l7BJy8haohSmuAR7BnjNz UMvlNX9wvQg9qJSzkS2hXo6+oXdaMnaK1fgHpuFYQ1e9424iNsI8iZG43brwVjxPT5kd IOpeFJsMgqDvBbkpYxUGcYD3JH6Rn+IYaq0tOHTlNN10DhNNsVlWZzfzbAtX2GDbCR9w C3pA== X-Gm-Message-State: APt69E1bk8EnokQnee+Sx+tLUVZ46B4hR1T/YBfXuTueOGaDEmrTQ/rb kVbmhFcO6jZLGXT3uG8PyL5iNHt2AlI= X-Received: by 2002:a2e:4811:: with SMTP id v17-v6mr6938418lja.39.1530191259185; Thu, 28 Jun 2018 06:07:39 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id d24-v6sm1314649lfl.53.2018.06.28.06.07.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Jun 2018 06:07:37 -0700 (PDT) From: Linus Walleij To: linux-crypto@vger.kernel.org, Herbert Xu , Tudor Ambarus Cc: Linus Walleij Subject: [PATCH 3/9 v2] crypto: atmel-ecc: More helpful error messages Date: Thu, 28 Jun 2018 15:07:23 +0200 Message-Id: <20180628130729.17589-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180628130729.17589-1-linus.walleij@linaro.org> References: <20180628130729.17589-1-linus.walleij@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Report errors once when they happen on the I2C bus so we get good information in cases such as when the wrong I2C address is used. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Strip some comments that are now obvious from the context with the error messages. - Do not print the excess ECC error message, atmel_ecc_status() already prints error messages. --- drivers/crypto/atmel-ecc.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) -- 2.17.0 diff --git a/drivers/crypto/atmel-ecc.c b/drivers/crypto/atmel-ecc.c index 33773920e4bf..baef0d07164d 100644 --- a/drivers/crypto/atmel-ecc.c +++ b/drivers/crypto/atmel-ecc.c @@ -310,26 +310,31 @@ static int atmel_ecc_send_receive(struct i2c_client *client, mutex_lock(&i2c_priv->lock); ret = atmel_ecc_wakeup(client); - if (ret) + if (ret) { + dev_err(&client->dev, "wakeup failed\n"); goto err; + } - /* send the command */ ret = i2c_master_send(client, (u8 *)cmd, cmd->count + WORD_ADDR_SIZE); - if (ret < 0) + if (ret < 0) { + dev_err(&client->dev, "command send failed\n"); goto err; + } /* delay the appropriate amount of time for command to execute */ msleep(cmd->msecs); - /* receive the response */ ret = i2c_master_recv(client, cmd->data, cmd->rxsize); - if (ret < 0) + if (ret < 0) { + dev_err(&client->dev, "getting response failed\n"); goto err; + } - /* put the device into low-power mode */ ret = atmel_ecc_sleep(client); - if (ret < 0) + if (ret < 0) { + dev_err(&client->dev, "putting to sleep failed\n"); goto err; + } mutex_unlock(&i2c_priv->lock); return atmel_ecc_status(&client->dev, cmd->data); @@ -624,8 +629,11 @@ static int device_sanity_check(struct i2c_client *client) atmel_ecc_init_read_cmd(cmd); ret = atmel_ecc_send_receive(client, cmd); - if (ret) + if (ret) { + dev_err(&client->dev, + "failed to send ECC init command\n"); goto free_cmd; + } /* * It is vital that the Configuration, Data and OTP zones be locked