From patchwork Tue Jun 5 13:49:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10448329 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7C5F9600CA for ; Tue, 5 Jun 2018 13:50:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CBCB29494 for ; Tue, 5 Jun 2018 13:50:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61680294A6; Tue, 5 Jun 2018 13:50:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12DCB29494 for ; Tue, 5 Jun 2018 13:50:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751940AbeFENuZ (ORCPT ); Tue, 5 Jun 2018 09:50:25 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:37954 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751750AbeFENuX (ORCPT ); Tue, 5 Jun 2018 09:50:23 -0400 Received: by mail-lf0-f67.google.com with SMTP id i83-v6so3710091lfh.5 for ; Tue, 05 Jun 2018 06:50:23 -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=4IBVmNkBN5dxSi2IItg5ld3vNZ4nRlduJskzBlx/EFc=; b=hVBggSAM6HvYGK7AoB7lTCd4EqQ/lzEZC47sNHhzKU7eSSzuiOYvtceaBq+HDEzNy/ WZ1M9UHQ1+EpZwEmgLJfDDuDAztFk1+yzIJXg4sgez/+zkF2BH95jdcjXZ+Xwl9/bbK7 UC7OUv7e7bY1jBiusV1zj8vpIhN/C7jZDzC6k= 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=4IBVmNkBN5dxSi2IItg5ld3vNZ4nRlduJskzBlx/EFc=; b=pd+Jj6kGBPsWJkvtNSbU/q9USgLt1zG6O5wuLVCQNXVoTYpxF55F22G/od0CAPp0Qt d7GG3AJDiVH85Xgorg9jNP3O8O0zaFKj+ieQAyV/GPJ/93aNP6idRYJ1WGXQn3BhAtAD u5ciU0Q3pIL/mGXXdsw/XqZGvLHWxh+VO3TSwKQavR21d6L81w5GaXKpmsgvPcJANraW z/++KC9hx6+xoG43HwM4uWNLJUWTg+nkhupSsGRLdKuFGaXhz1cean9Fg4rqRwhHA9ZU D4EhW3aDCYMqU8t60ryHNXRkz3ugzl1c5wLXk1eEsdiRTk57w3kXwWPgcuBaKKhyz4J/ uFbg== X-Gm-Message-State: APt69E3c6M3cAES7Z74qxDmWYxEH8WjL3Ylz9PsrkqZX+hQQeZDYWuKZ GnFvhXFq3z2MLzZA1K5oaErcuRFX9Ms= X-Google-Smtp-Source: ADUXVKLzkjiJGftqY+V8Tylt+E409eWAoyCtvDt2Zfsi3B6CJPXKR7lvVo9uPX3laYnnobl+jcLCbg== X-Received: by 2002:a19:ca0b:: with SMTP id a11-v6mr1674250lfg.69.1528206621778; Tue, 05 Jun 2018 06:50:21 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id x72-v6sm5201092lfi.52.2018.06.05.06.50.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jun 2018 06:50:20 -0700 (PDT) From: Linus Walleij To: linux-crypto@vger.kernel.org, Herbert Xu , Tudor Ambarus Cc: Linus Walleij Subject: [PATCH 2/9] crypto: atmel-ecc: Silently ignore missing clock frequency Date: Tue, 5 Jun 2018 15:49:43 +0200 Message-Id: <20180605134950.6605-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180605134950.6605-1-linus.walleij@linaro.org> References: <20180605134950.6605-1-linus.walleij@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The Atmel ECC driver contains a check for the I2C bus clock frequency, so as to check that the I2C adapter in use satisfies the device specs. If the device is connected to a device tree node that does not contain a clock frequency setting, such as an I2C mux or gate, this blocks the probe. Make the probe continue silently if no clock frequency can be found, assuming all is safe. Signed-off-by: Linus Walleij --- drivers/crypto/atmel-ecc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/atmel-ecc.c b/drivers/crypto/atmel-ecc.c index e66f18a0ddd0..145ab3a39a56 100644 --- a/drivers/crypto/atmel-ecc.c +++ b/drivers/crypto/atmel-ecc.c @@ -657,14 +657,13 @@ static int atmel_ecc_probe(struct i2c_client *client, return -ENODEV; } + /* + * Silently assume all is fine if there is no + * "clock-frequency" property. + */ ret = of_property_read_u32(client->adapter->dev.of_node, "clock-frequency", &bus_clk_rate); - if (ret) { - dev_err(dev, "of: failed to read clock-frequency property\n"); - return ret; - } - - if (bus_clk_rate > 1000000L) { + if (!ret && (bus_clk_rate > 1000000L)) { dev_err(dev, "%d exceeds maximum supported clock frequency (1MHz)\n", bus_clk_rate); return -EINVAL;