From patchwork Mon Dec 28 12:42:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 354671 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A4D8C433E6 for ; Mon, 28 Dec 2020 15:15:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 31806207A1 for ; Mon, 28 Dec 2020 15:15:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438168AbgL1POo (ORCPT ); Mon, 28 Dec 2020 10:14:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:40644 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438027AbgL1OGm (ORCPT ); Mon, 28 Dec 2020 09:06:42 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 305CC20791; Mon, 28 Dec 2020 14:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164386; bh=5Yj+Icl0cTkfiOcHrsPRlfV0BgvmHbw5Ijx5i1JtqAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vLCWEbf2DZlcpaEn+MJ+7azK7JVUsFGtF/ln7kzxYsQxHBkwwnmOIYfDapdhmRkFx M8dVilCKok2Z27bVytcu/EF38AwQrOm3JyRAu0O/VwimIvy2yXaCx7IGNGzDmBnSwM V0JIPmrgGBRVrywa3SucWvL3TsO836HMwCtnRRfo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amelie Delaunay , Lee Jones , Sasha Levin Subject: [PATCH 5.10 162/717] mfd: stmfx: Fix dev_err_probe() call in stmfx_chip_init() Date: Mon, 28 Dec 2020 13:42:40 +0100 Message-Id: <20201228125028.718295346@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Amelie Delaunay [ Upstream commit d75846ed08e6f4135ec73778575c34d9c0ace993 ] 'ret' may be 0 so, dev_err_probe() should be called only when 'ret' is an error code. Fixes: 41c9c06c491a ("mfd: stmfx: Simplify with dev_err_probe()") Signed-off-by: Amelie Delaunay Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/mfd/stmfx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/mfd/stmfx.c b/drivers/mfd/stmfx.c index 5e680bfdf5c90..988e2ba6dd0f3 100644 --- a/drivers/mfd/stmfx.c +++ b/drivers/mfd/stmfx.c @@ -329,11 +329,11 @@ static int stmfx_chip_init(struct i2c_client *client) stmfx->vdd = devm_regulator_get_optional(&client->dev, "vdd"); ret = PTR_ERR_OR_ZERO(stmfx->vdd); - if (ret == -ENODEV) { - stmfx->vdd = NULL; - } else { - return dev_err_probe(&client->dev, ret, - "Failed to get VDD regulator\n"); + if (ret) { + if (ret == -ENODEV) + stmfx->vdd = NULL; + else + return dev_err_probe(&client->dev, ret, "Failed to get VDD regulator\n"); } if (stmfx->vdd) {