Received: by 10.192.165.148 with SMTP id m20csp1917802imm; Sat, 28 Apr 2018 08:09:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpTcFmON92P5Y+GxLu3OuKql1CwQcxkCJghWsgK0wWsQEuLbaBaF7fS8D6c+zu3xp0b+XYf X-Received: by 2002:a63:ae49:: with SMTP id e9-v6mr5317223pgp.38.1524928198696; Sat, 28 Apr 2018 08:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524928198; cv=none; d=google.com; s=arc-20160816; b=PB+XeD0PDVoi1f1au4hIDS/gy+I1uaDqOfAJF5WnkIkRDs9c25XWkYQJ1QTqWk+zLY dBqdn69pdpcOTFKbxmyze3YWPtnQPWye1HOYUoIJ0UV4rkX0eqMde0ad/vOON03Utqs8 mMR6upUjb65pz2z0uFFlEOuTFDGNSVrs3o813uWALDQ1lP2x1NbSevnfNMnaJ5Vuibfq 21kZds3k9nSIbM5kpxm6setZMmWe8XkhWXc9I1U4F5BGM+E3CnL9PlRPJjICQk7GjKv2 nwBoHy3U+evHsoNwKNgxlvwR0UOe1aozUnoF5AtYLEDh/6ketRMP/nlu8mUuQT8rKYbs BUiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dmarc-filter:arc-authentication-results; bh=bdjM8eJxRWiu1J3A6lkSKpdYawmx+9cmiRiEIJ+jnrc=; b=0idzERrLd7Ryu45gq90nAgz67cxEZate7aisa7WLXfdzwpCZdtbuD6hH+QpYN3b1eq ySLg6ueuG/RT6ADOmWFXhK1Cb3eIgbJIvagggfJhZnYlRESKDZdgKk5xp8ejgDCiXVua xtP+3Qwh+3WldOFGjKNYTDhYu42omkdxtcYObymqL0vQmJARNm9XYU5LW1V6kZjQymZL XcfyFFbBmn2aSqfRY2hsqSE/0XaQYWSI5Se7j6l5L7jYq+Q4wce94keGiYjxRVGbA4Bm bldjK2SrrrIr+Gd3cys1NPTJm2Z5wpwAzj6W+GSxUZ6a/ePEWgZ9p7YFJPJq8WUeLbLZ NL4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m137-v6si3217305pga.382.2018.04.28.08.09.43; Sat, 28 Apr 2018 08:09:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932466AbeD1PIa (ORCPT + 99 others); Sat, 28 Apr 2018 11:08:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:33432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751742AbeD1PIP (ORCPT ); Sat, 28 Apr 2018 11:08:15 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7C84721E92; Sat, 28 Apr 2018 15:08:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C84721E92 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jic23@kernel.org Date: Sat, 28 Apr 2018 16:07:54 +0100 From: Jonathan Cameron To: Fabrice Gasnier Cc: , , , , , , , , , Subject: Re: [PATCH 7/7] iio: adc: stm32-dfsdm: add check on spi-max-frequency Message-ID: <20180428160754.298afa0b@archlinux> In-Reply-To: <1519390261-25453-8-git-send-email-fabrice.gasnier@st.com> References: <1519390261-25453-1-git-send-email-fabrice.gasnier@st.com> <1519390261-25453-8-git-send-email-fabrice.gasnier@st.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 23 Feb 2018 13:51:01 +0100 Fabrice Gasnier wrote: > spi-max-frequency is requested for SPI master mode (only), to tune output > clock. It may happen requested frequency isn't reachable. > Add explicit check, so probe fails with error in this case. Otherwise, > output clock may simply be silently turned off (conversions fail). > > Signed-off-by: Fabrice Gasnier Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with. Thanks, Jonathan > --- > drivers/iio/adc/stm32-dfsdm-core.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/iio/adc/stm32-dfsdm-core.c b/drivers/iio/adc/stm32-dfsdm-core.c > index e50efdc..1d0d823 100644 > --- a/drivers/iio/adc/stm32-dfsdm-core.c > +++ b/drivers/iio/adc/stm32-dfsdm-core.c > @@ -227,6 +227,11 @@ static int stm32_dfsdm_parse_of(struct platform_device *pdev, > } > > priv->spi_clk_out_div = div_u64_rem(clk_freq, spi_freq, &rem) - 1; > + if (!priv->spi_clk_out_div) { > + /* spi_clk_out_div == 0 means ckout is OFF */ > + dev_err(&pdev->dev, "spi-max-frequency not achievable\n"); > + return -EINVAL; > + } > priv->dfsdm.spi_master_freq = spi_freq; > > if (rem) {