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: 137735 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp985925lji; Tue, 5 Jun 2018 06:50:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKSGe0S7wkbvAxn4x3sokw9vOA4ZOxPPlpTw2s8RIa19yfECmKjqC3zRiYWBKJO4O+M/P7D X-Received: by 2002:a65:6250:: with SMTP id q16-v6mr21330537pgv.113.1528206630226; Tue, 05 Jun 2018 06:50:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528206630; cv=none; d=google.com; s=arc-20160816; b=AZxtsXpKnoLQYJGBIdoByJ6NATG2kXOFlTZ3TIQ3q9Ce56hSNEQG9MoL2hg7tT8tWz za8dZdqAv15VqA5eVd8RIooTFPusAObuLt8Bhy6sg4eRpiCOYWHMBLK8NAxAEUe+dpN0 jQ+JAPTpP2F9CTylHevvQp3qLeW4fP92b9R47tgp3OccmVj57oQlFlI2MezTG4NLu142 zPk+BbO93vrNlMFBUwOyP139CgvQl/mmhnEVSEHu7Kcx1tLqVjzodhYMVCh9YgJdDbxe UAzzLUk4hsOPRPif0B5198Zb14KLuVmg6RthDI+tv9O3ZfVyIp3mw3ZZZdMrJHpe3OXg HoFA== 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=4IBVmNkBN5dxSi2IItg5ld3vNZ4nRlduJskzBlx/EFc=; b=JMsvu+AdMx0i2wTTlKrI8jTYwHym8SN18FA7I0udr3KqZe9LUC+mS/MQxB0OZLRxsH VqhdnLTojhBnsXS5COIDDIsUUAR2sDH+4M3FkWQ/OJLyFA77T/YAdip+3JFycpeBEPhV UBlrFE5vdc/w+nD0K6+xCsrYglqdls7FPLYNBnEOz0mrVpfKf5LSI9QzRS/e6VGdkgck Y8wtKVpwWSd+BFm1Be3yZgrKLTRKBBewS47vWlQ/4ID8+xSAlurTeZCTL2jg9ow63Nnp mNajhH07I5WF8ew6GMfSSr+5WQoj24iJCpdycxh6quzUCXW67uYZTnb7foivEUW9XrFI axgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hVBggSAM; 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 j78-v6si24186154pfe.187.2018.06.05.06.50.27; Tue, 05 Jun 2018 06:50:30 -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=hVBggSAM; 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 S1751940AbeFENuZ (ORCPT + 1 other); 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-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 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(-) -- 2.17.0 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;