From patchwork Thu Mar 2 11:01:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 63344 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4170938wrd; Thu, 2 Mar 2023 03:07:25 -0800 (PST) X-Google-Smtp-Source: AK7set/cD5B7dbelvYFxvNNho3Bt+KfrJqKIuwsdjRt5MEVBkbh2A27RRFeYMvuBeHYkV4wFKpKP X-Received: by 2002:aa7:d44c:0:b0:4ad:7481:c2fe with SMTP id q12-20020aa7d44c000000b004ad7481c2femr9653083edr.22.1677755245014; Thu, 02 Mar 2023 03:07:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677755244; cv=none; d=google.com; s=arc-20160816; b=i0jruKAlzK+eOHJiuXBGn1zBJyHRADPZi9J0PWCsGSpFP8QBg6aJ4nDbLs/TGAjUbc jXwXtpxfLGrrgjqQ5Qm8So3w/NVjwQXYIyS5rxrsyTpqt84tQC+z3vcY7iNnP4JG+qSL w7Je3F5plrkbfgsBa2DnbOevhK+U6UY2rFH5SQNzTXQdzYxI8KUMCyzTbvPULDOQDMr2 qE3btg+htKHgO9AZi+cGZNCGePCScsBDEIuL9+xJDi0S5I4h9gO49pm/msME5asXSxuf efC44CCdQXnfrsfCLGNJLgJckhVZxx//9FgbnX5NzQ2s/dEtb10e8WR1NY1sYhDssCdn 31bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rAConIH8oRnQDg8tTPGuNoHLNaJMUa0nvUVhG9OfTSI=; b=TtmSSmdTDzledTVoBU3jd2s1d/0+5Mxlm80GKHzK+PIqlwhaWeVU+e8CzEgS6Q+58t 9OsQa/vYXy4ksE6yqDxI0FyoDzsU9u/xeSfE5iaOUFd2bDaKd3r5FotjU2XWjSliausT TmoSWAbJjsUXcTkdB/sdxK8IfAjMjUPEGE2gmYBwGsnwgyjCLfts9NNQnF6F+Vi3+Z/S hY8eZUrqYcZM3EvjQa6CM0D0HZUJrBHbEFuiKwvBVuPtNRZJYAwFRp8TVLBLBaaHNUwn +Od8JzqULSQxFFbUax+yacl9PNUxsaBn1gBOlirOt/Rhpe7oyfd1gi5CV6/2i5Kvsjae VPqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=T1xvdqkY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b15-20020aa7c90f000000b004bfe31dbd46si1882173edt.199.2023.03.02.03.07.02; Thu, 02 Mar 2023 03:07:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=T1xvdqkY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230122AbjCBLCC (ORCPT + 99 others); Thu, 2 Mar 2023 06:02:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229957AbjCBLBw (ORCPT ); Thu, 2 Mar 2023 06:01:52 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6DC448E1B; Thu, 2 Mar 2023 03:01:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1677754900; x=1709290900; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gX9P046dW17ln8lj8QobxPkcMbEPnX2RXibkQe5EQhM=; b=T1xvdqkYKaBAI5U8Hkx0x/VUgRKCQVSHKRzIMTZIwxZwGgS2m/gupWMe 0sVRC4uElOfp6a3CxgXoOiy52gbil+jHpfiLvWoewIqF5LqoSH1Ba+H/4 TOoq9IsjBoz+h3lam//H8Uz1fOe4xTBUKUDlb5gK5Rz1C/DuyksSeT+sA 7SLEyi4+yEenbpPUoYC18wdeT8dARazmsv6QHGNAbTSxkSahTcZxkAoth mynpNvhykr4Pp4eJe16UnOCzvgRt5XY/l2ZhrVEfx+PRYjunCz6DvI84l RXv3y/gFbJYeS/jYQCW+AFZaPRJ46JU2uqhmbQH/y8lXuhQDpDCOYjaFH Q==; X-IronPort-AV: E=Sophos;i="5.98,227,1673938800"; d="scan'208";a="199564392" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 02 Mar 2023 04:01:39 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 2 Mar 2023 04:01:38 -0700 Received: from m18063-ThinkPad-T460p.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 2 Mar 2023 04:01:36 -0700 From: Claudiu Beznea To: , , , CC: , , , Claudiu Beznea Subject: [PATCH 3/4] pinctrl: at91-pio4: use dev_err_probe() Date: Thu, 2 Mar 2023 13:01:15 +0200 Message-ID: <20230302110116.342486-4-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230302110116.342486-1-claudiu.beznea@microchip.com> References: <20230302110116.342486-1-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759253883739225703?= X-GMAIL-MSGID: =?utf-8?q?1759253883739225703?= Use dev_err_probe() to simplify the code. Signed-off-by: Claudiu Beznea --- drivers/pinctrl/pinctrl-at91-pio4.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c index 93023d0fd75b..783968182bc7 100644 --- a/drivers/pinctrl/pinctrl-at91-pio4.c +++ b/drivers/pinctrl/pinctrl-at91-pio4.c @@ -1079,10 +1079,9 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) platform_set_drvdata(pdev, atmel_pioctrl); atmel_pioctrl_data = device_get_match_data(dev); - if (!atmel_pioctrl_data) { - dev_err(dev, "Invalid device data\n"); - return -ENODEV; - } + if (!atmel_pioctrl_data) + return dev_err_probe(dev, -ENODEV, "Invalid device data\n"); + atmel_pioctrl->nbanks = atmel_pioctrl_data->nbanks; atmel_pioctrl->npins = atmel_pioctrl->nbanks * ATMEL_PIO_NPINS_PER_BANK; /* if last bank has limited number of pins, adjust accordingly */ @@ -1097,10 +1096,8 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) return PTR_ERR(atmel_pioctrl->reg_base); atmel_pioctrl->clk = devm_clk_get_enabled(dev, NULL); - if (IS_ERR(atmel_pioctrl->clk)) { - dev_err(dev, "failed to get clock\n"); - return PTR_ERR(atmel_pioctrl->clk); - } + if (IS_ERR(atmel_pioctrl->clk)) + return dev_err_probe(dev, PTR_ERR(atmel_pioctrl->clk), "failed to get clock\n"); atmel_pioctrl->pins = devm_kcalloc(dev, atmel_pioctrl->npins, @@ -1200,10 +1197,8 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) atmel_pioctrl->irq_domain = irq_domain_add_linear(dev->of_node, atmel_pioctrl->gpio_chip->ngpio, &irq_domain_simple_ops, NULL); - if (!atmel_pioctrl->irq_domain) { - dev_err(dev, "can't add the irq domain\n"); - return -ENODEV; - } + if (!atmel_pioctrl->irq_domain) + return dev_err_probe(dev, -ENODEV, "can't add the irq domain\n"); atmel_pioctrl->irq_domain->name = "atmel gpio"; for (i = 0; i < atmel_pioctrl->npins; i++) {