Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3936709ybl; Mon, 13 Jan 2020 05:18:20 -0800 (PST) X-Google-Smtp-Source: APXvYqzfdDA4PzqDl0W22ZontYvgHr332BMewbY5Lhz0V1INsmZORnt615NwXlddf5lUIhet8Wai X-Received: by 2002:a05:6830:1f95:: with SMTP id v21mr13351192otr.325.1578921500027; Mon, 13 Jan 2020 05:18:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578921500; cv=none; d=google.com; s=arc-20160816; b=KuxrdPl1QinV61Zr6C1Hq+tIMvPyaZn/XL0flrspEI/QZSFik2tG88LUkpkcPgxvB5 DqW80f4A8TwrGnhJy9K2iZBSuchlXnpqXA/G+fF4nb/gp1uYZIqIxRLmw+vkJ7mV2E+g lWTgARV5LgphnH2uvj+7Ge2WQ61q+EVqhsOHZ9S0MVbnij1owfC1Q/3TVzf6XFNdyyBv 3F6LFf89XGCzhoaWr7W+0c+n/fdN0MccOhPYdoyei+HZxGDgepMzezaKznP72/AHwGiI Z3zf+vUjGn9/4BLiMUMb+Ri3TLJzjlab7zZt4HObuWhZyo8j2duW5eeOmGepHVLpiOLU oWGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=DU1Kp8lh2uFkanGLFhtVCisPZCszaBxv5SgsLyQ1bx0=; b=GsBHXk3DShrSwg+uolB6rJmLF3Xmf8+LBA8uTmHarVXc28GGT1N+9Pmi/UsuPWhAwY X+VKvZMpJu7un5zxTaJoKsdc/rqnq6GazdDQBFafv97FMCxYwIRVwQZOCpFlDcE1loaL bCgp0Q+C+ytU7ktJUgtrlTeQcxCxhhzkP8+zT2gpKugZHEYcVEF/r8KuLN/ESamJsgQ2 9PaMBbfPpOnuW3bJr7P8po1hopR4mkvPS5Q+wh9+bvsPOV9K/VgWEScw4sPhDO4kgslc +iblip68Kn/4Lhs75uoRQS88JD6M1MdlRQVXral4K0NQ9MWSFawoSjAULEfGag1LH705 3eDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b="EtavOXx/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a64si6209963oif.256.2020.01.13.05.18.08; Mon, 13 Jan 2020 05:18:20 -0800 (PST) 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; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b="EtavOXx/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728741AbgAMNQB (ORCPT + 99 others); Mon, 13 Jan 2020 08:16:01 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:5658 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728665AbgAMNP7 (ORCPT ); Mon, 13 Jan 2020 08:15:59 -0500 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00DDCY4e025708; Mon, 13 Jan 2020 14:15:35 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=DU1Kp8lh2uFkanGLFhtVCisPZCszaBxv5SgsLyQ1bx0=; b=EtavOXx/JdnjibUoR7WnFypLoKMkRohpE5L/Nb81EOal4LSsz/5uTlINyd4wZ0v4P992 xZBqWFbOPXSUD74IL1Z4L+mmRF+lGgBy+o8EM35keWM3XB2s4HbsE/fTnFdivv/SO9uR gKIf5AM//8nZh+s6ihTSOG56U7BL2x/vBDf24X6c83oPdEYn+5Rpt7xzV87MJMBu/QRb 2bDzK6ENeUhu1NyPuBL7wR0Hbq+YcCPRwnSXi1Y4/H+8hX6NE+uCtl2+X+v+BvlB0onm w6XngRN5MWimVD+I3RiHa9aTYP+gLdxgDu3pr1IiAsVZkqwKVQjebx29KbGbX/lx9UPr sg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2xf78s07du-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jan 2020 14:15:35 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A03BF10003A; Mon, 13 Jan 2020 14:15:34 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag5node3.st.com [10.75.127.15]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 925452B820F; Mon, 13 Jan 2020 14:15:34 +0100 (CET) Received: from localhost (10.75.127.45) by SFHDAG5NODE3.st.com (10.75.127.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 13 Jan 2020 14:15:34 +0100 From: Fabrice Gasnier To: CC: , , , , , , , , , , , Subject: [PATCH 2/2] iio: dac: stm32-dac: better handle reset controller failures Date: Mon, 13 Jan 2020 14:14:26 +0100 Message-ID: <1578921266-6025-3-git-send-email-fabrice.gasnier@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1578921266-6025-1-git-send-email-fabrice.gasnier@st.com> References: <1578921266-6025-1-git-send-email-fabrice.gasnier@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG7NODE3.st.com (10.75.127.21) To SFHDAG5NODE3.st.com (10.75.127.15) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-01-13_03:2020-01-13,2020-01-13 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Etienne Carriere Use devm_reset_control_get_optional_exclusive() instead of devm_reset_control_get_exclusive() as reset controller is optional. Nevertheless if reset controller is expected but reports an error, propagate the error code to the caller. In such case a nice error trace is emitted unless we're deferring the probe operation. Signed-off-by: Etienne Carriere Signed-off-by: Fabrice Gasnier --- drivers/iio/dac/stm32-dac-core.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c index 4d93446..7e5809b 100644 --- a/drivers/iio/dac/stm32-dac-core.c +++ b/drivers/iio/dac/stm32-dac-core.c @@ -147,8 +147,16 @@ static int stm32_dac_probe(struct platform_device *pdev) priv->common.vref_mv = ret / 1000; dev_dbg(dev, "vref+=%dmV\n", priv->common.vref_mv); - rst = devm_reset_control_get_exclusive(dev, NULL); - if (!IS_ERR(rst)) { + rst = devm_reset_control_get_optional_exclusive(dev, NULL); + if (rst) { + if (IS_ERR(rst)) { + ret = PTR_ERR(rst); + if (ret != -EPROBE_DEFER) + dev_err(dev, "reset get failed, %d\n", ret); + + goto err_hw_stop; + } + reset_control_assert(rst); udelay(2); reset_control_deassert(rst); -- 2.7.4