From patchwork Wed Aug 26 18:16:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 255057 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=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable 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 827A4C433DF for ; Wed, 26 Aug 2020 18:20:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5497F207BC for ; Wed, 26 Aug 2020 18:20:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598466006; bh=DPQF77aMjkh7Faa6F4bZ0KOUmZpaZ+wObfMV6Kit2jo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=GtJSYUvKROK45Y/xU6y7Y1EM4cT0MYE1vmXqvBmQSdj2gerpHCyXpncn8IvbGxi78 gDw4v8ArGSDCoU91I7LbW2S6534iDJ9A3OCyg/fC0LGxXFJgpH/trbU55RpcKIHsoN v+4M4ZDUUicOjBRHUcK5+INhPqjg935KEVylBej0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727061AbgHZSSC (ORCPT ); Wed, 26 Aug 2020 14:18:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:40936 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726442AbgHZSR5 (ORCPT ); Wed, 26 Aug 2020 14:17:57 -0400 Received: from kozik-lap.mshome.net (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2DD1B2083B; Wed, 26 Aug 2020 18:17:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598465876; bh=DPQF77aMjkh7Faa6F4bZ0KOUmZpaZ+wObfMV6Kit2jo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PbBpUBLm5MDXI2Ck3SvUjsj1zYVbR0BAcdelKMYhlfODxf3q+tLb5Lp6ORHN95uST XoajrjKgJuamZ601iFTHooRBYfL7QFtDoyYRl41TVhWmst6/hN8VLpzIUu31pCu6OE lubuHAw0LDBp6o/cIj+gn/wkmptlkKGWqDFyN/VQ= From: Krzysztof Kozlowski To: Dmitry Torokhov , Hans de Goede , Linus Walleij , Bastien Nocera , Sangwon Jee , Eugen Hristev , "Gustavo A. R. Silva" , Andy Shevchenko , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 08/24] Input: elan_i2c - Simplify with dev_err_probe() Date: Wed, 26 Aug 2020 20:16:50 +0200 Message-Id: <20200826181706.11098-8-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200826181706.11098-1-krzk@kernel.org> References: <20200826181706.11098-1-krzk@kernel.org> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski --- drivers/input/mouse/elan_i2c_core.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index c599e21a8478..d703b0d5a3bd 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -1229,13 +1229,8 @@ static int elan_probe(struct i2c_client *client, mutex_init(&data->sysfs_mutex); data->vcc = devm_regulator_get(dev, "vcc"); - if (IS_ERR(data->vcc)) { - error = PTR_ERR(data->vcc); - if (error != -EPROBE_DEFER) - dev_err(dev, "Failed to get 'vcc' regulator: %d\n", - error); - return error; - } + if (IS_ERR(data->vcc)) + return dev_err_probe(dev, PTR_ERR(data->vcc), "Failed to get 'vcc' regulator\n"); error = regulator_enable(data->vcc); if (error) {