From patchwork Thu Jul 25 07:56:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 169684 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp11292776ilk; Thu, 25 Jul 2019 00:56:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2Fo3ayhYCf+9q+9AyR6Sc1f20ZAiiUE3wyPrvArV6Hz+zf8dapL1R6SA87VK6pRRXcLbD X-Received: by 2002:a17:902:9a49:: with SMTP id x9mr90356346plv.282.1564041404145; Thu, 25 Jul 2019 00:56:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564041404; cv=none; d=google.com; s=arc-20160816; b=J6TUj5SKdFkDRYKhgeTjvXcVpgdc9jH0u3qt76ftTPz6BQgseTggq7hHTFccznEkub 0UKrMh2MEl0pIuVdM6Xyu3QfsOvCTU26cxd2EA8CoWeHj15oEEcYrYe35GN0lIgdRNN/ Az5hSPZ6pEzjSOvMuoaZCA+fMvlP3n29W2zzB/UKUFI1nKxIMZmvr5mM2AmK8WkuS/Nr 7REPi2WyHU57r5j0sG1zcJShvGLVRxfdxPoB6pgI+faOoKwfXiRAQHf60FdXkb6pP4OW ZHcwRSeaiM3OiEKyMbdK1s6ze9Hg5aJRmXAWVBTitAJTwgl3k0jGIyRt8+5UPRyEjgi+ fAuQ== 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:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=eNURmCt1o5sob1QOowvJXr5pL73KlOzcHKdzSxjtEkQ=; b=rvdZCJuj2D1VxWGymXb0UQmTD+SffTdxUftxTbpzhhMrknDyFwIZCyDCJkDgW+cS19 X73MjBNG4zkx/RXJ6NftIOx+gt8IH4f2dyaRQ9sNKgmfbCXaxQi7hmW1vCBsjPZxtL2S B/XCp7X3iupO1wkCbwLOgdO12uh6C2sfgMJ2yArp7IfnRdVjl3J8vrkYjHsPMNvo8Vc3 9sAP82O/yWlSNe13q7WjruyrjZ8bSVpY2mdKbppV1NrJaA3jhX4MDaNUp7wZOmzQ+o/6 kzM2vMYnYU2TE/Eu2Gv9mhS9g+WaIVv8OLAliQClNmw5gJog3FhvkvzAsNvhDdzbRyRJ JpRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U7zeKlTb; spf=pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-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 x4si17215026pln.70.2019.07.25.00.56.43; Thu, 25 Jul 2019 00:56:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-i2c-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=U7zeKlTb; spf=pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-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 S2388696AbfGYH4m (ORCPT + 2 others); Thu, 25 Jul 2019 03:56:42 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:38957 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388726AbfGYH4l (ORCPT ); Thu, 25 Jul 2019 03:56:41 -0400 Received: by mail-pg1-f193.google.com with SMTP id u17so22604677pgi.6 for ; Thu, 25 Jul 2019 00:56:41 -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 :in-reply-to:references; bh=eNURmCt1o5sob1QOowvJXr5pL73KlOzcHKdzSxjtEkQ=; b=U7zeKlTbIuS5u7DJxz9XnFhiBxEa+BpR7S41Ci+3WJQgscfSV6So2gzcTVQd+R96nf 5bg7QLcpx9FMCe/bbTeQ9qWon/c3Em0JdujbSKBovxMrHDRMbHPFUuxE0ZuVlhEoZbul Yxwj3ky3V06UmwsFaveXirOuoElDv2qXDcZPJ4pPMn2QK//CIoDzMdS3l0BHFhBW+NfI FLBhyvp4e5tBqxKQWI9M+VaoMfn/DaN4MOm+qzA1OSHnWH38gCy5D5VvVwS5psNckamW Wv79LKVv8TX6CrbAJq69u9WQIvlYR068FfnYjuIthjm0VOqh8SMh/KR3z/GyrC2TfUTF K0Hg== 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:in-reply-to:references; bh=eNURmCt1o5sob1QOowvJXr5pL73KlOzcHKdzSxjtEkQ=; b=V2vkuDUqh/LoqQOYLiFcnuIGAX4w6Aqike0jdvKvhwXTyVNhBNWVBVgqvPKGWL/rIc 0i0XLgGvURS74nRNgbeDZuJ6o8hRlyAKXmo+mXTX8h/gzPF5MYk1157vxJ81rQ9Hem9i Fz386rGmTREVeOo7pwk5giJBSyPOh2XdAefBUBTXN56cVInsxFpyhyvhSjG7PMXyXkh9 4ib94eQF/GxHp/hepJRFoXDE7DC5YQQilL4e0azNaInAALeafunauRnEglpehsPBMqtw hnJzDUZsuM86pG5Aau0w0Zz70s8swR4uK1s3uIGPz4D2vUJN+JbuIJFJUbzxN1q9Ctjy NjFw== X-Gm-Message-State: APjAAAVsMN8zHg727z+WYb4j19X+205ao0eTpQfbN3OpISTO572YOByr M/QKImDNU6kgGzwYpfJbdCp1Hw== X-Received: by 2002:a17:90a:8688:: with SMTP id p8mr92850220pjn.57.1564041400592; Thu, 25 Jul 2019 00:56:40 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id m9sm89021419pgr.24.2019.07.25.00.56.38 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 Jul 2019 00:56:40 -0700 (PDT) From: Baolin Wang To: wsa+renesas@sang-engineering.com, orsonzhai@gmail.com, zhang.lyra@gmail.com Cc: baolin.wang@linaro.org, vincent.guittot@linaro.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] i2c: sprd: Validate the return value of clock initialization Date: Thu, 25 Jul 2019 15:56:18 +0800 Message-Id: <5f64dc0eedb348b15442f31f2f22f5bded7cd6ef.1564041157.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The 'enable' clock of I2C master is required, we should return an error if failed to get the 'enable' clock, to make sure the I2C driver can be defer probe if the clock resource is not ready. Signed-off-by: Baolin Wang --- drivers/i2c/busses/i2c-sprd.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) -- 1.7.9.5 diff --git a/drivers/i2c/busses/i2c-sprd.c b/drivers/i2c/busses/i2c-sprd.c index bbcb056..b432e75 100644 --- a/drivers/i2c/busses/i2c-sprd.c +++ b/drivers/i2c/busses/i2c-sprd.c @@ -466,9 +466,9 @@ static int sprd_i2c_clk_init(struct sprd_i2c *i2c_dev) i2c_dev->clk = devm_clk_get(i2c_dev->dev, "enable"); if (IS_ERR(i2c_dev->clk)) { - dev_warn(i2c_dev->dev, "i2c%d can't get the enable clock\n", - i2c_dev->adap.nr); - i2c_dev->clk = NULL; + dev_err(i2c_dev->dev, "i2c%d can't get the enable clock\n", + i2c_dev->adap.nr); + return PTR_ERR(i2c_dev->clk); } return 0; @@ -519,7 +519,10 @@ static int sprd_i2c_probe(struct platform_device *pdev) if (i2c_dev->bus_freq != 100000 && i2c_dev->bus_freq != 400000) return -EINVAL; - sprd_i2c_clk_init(i2c_dev); + ret = sprd_i2c_clk_init(i2c_dev); + if (ret) + return ret; + platform_set_drvdata(pdev, i2c_dev); ret = clk_prepare_enable(i2c_dev->clk);