From patchwork Tue May 5 14:52:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aishwarya Ramakrishnan X-Patchwork-Id: 207653 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=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 79630C47254 for ; Tue, 5 May 2020 14:52:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55415206B9 for ; Tue, 5 May 2020 14:52:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fjUIqMr+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729264AbgEEOwl (ORCPT ); Tue, 5 May 2020 10:52:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729247AbgEEOwl (ORCPT ); Tue, 5 May 2020 10:52:41 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57E51C061A0F; Tue, 5 May 2020 07:52:41 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id ms17so1202637pjb.0; Tue, 05 May 2020 07:52:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=qeWqebBHbrz9NQE1LcRIuA9aTCykR2qMhUZdHa+RvL0=; b=fjUIqMr+zGxzzUUBgAEuYYK9aZncUkkyFdarjhMrNGCgOunWKLZeSIhCtRXw99thdD oiyjjFE+DRHnFQhUkWg+iK3KFLZDVF5n9ZpdOpIjwy6mpoSU130fSMdRgIe0f3R35UWX f4CAADXAst1CY/ucuPMN2nfq0ldp/bIGdCfsVI6TCNfVuB0PmMLQp/KgDeHvuYoPBYKW EwX94ySVNV/XPu4GCgbuhp/qpxni/sIaBWn1x765W6uubdhKpVSIGVtWVWzphKgXeQli E36Vi/5qUqFHu4xnRTENDoPNpeHC71anz7MYoQ4EpPWz9UvX59IacPvIWcrUnB0n+YR+ Pk6w== 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; bh=qeWqebBHbrz9NQE1LcRIuA9aTCykR2qMhUZdHa+RvL0=; b=B7fNtFAHTVOZlJhjXG45SG3vxFopZ/w3Mj3fscrCW0jO0ayD83Z/+HLeaQ9pOk8ou4 fVnDlB1SDEUCLfKJ+wN/SkIDwaUzDo0Zf6uf1DDvimvnUqP5AfzaFxaExGOzbyc/yHfh +3FycyaFNBfBXX2pJf8hS1EPWKg4yekQF2/rcoDWR4vwRqnAoaS7J2q1CFAvAbYDswy5 qvOJJ8ll/8VqanpeGD+QcOjGcEdOiRlJONbjufpxzFLVBmrFeWcQ1kKNSDK/+5s76XZC yMNBywgdB0lApKdzV9YIHMjGVtUBYDLENgJ4RuR83t4JItflCA91HIUUOk8AfDPsynKJ XD+A== X-Gm-Message-State: AGi0PubZPGsQCSRzq5ktaKMyyLNgtubMUqUufgRqOCE7lg8e6xXXmvkp lQF2I/K8OgTK3Dh7QTwfzD7d956G+XU= X-Google-Smtp-Source: APiQypL1DKywSBZ86WXFhTqtJMGcw+qG8kDnXiyGO0lp/kyvsgEzWRpSdWtSWECCJVtxUqz6kdAPPg== X-Received: by 2002:a17:90a:ad02:: with SMTP id r2mr3597818pjq.63.1588690360880; Tue, 05 May 2020 07:52:40 -0700 (PDT) Received: from localhost.localdomain ([2409:4072:60b:fcd9:7c28:bcca:10e4:5523]) by smtp.gmail.com with ESMTPSA id d2sm2249630pfc.7.2020.05.05.07.52.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2020 07:52:40 -0700 (PDT) From: Aishwarya Ramakrishnan To: Ajay Gupta , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: aishwaryarj100@gmail.com Subject: [PATCH] i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify code Date: Tue, 5 May 2020 20:22:30 +0530 Message-Id: <20200505145230.17251-1-aishwaryarj100@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR. Generated by: scripts/coccinelle/api/ptr_ret.cocci Signed-off-by: Aishwarya Ramakrishnan --- drivers/i2c/busses/i2c-nvidia-gpu.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c index f5d25ce00f03..f480105000b8 100644 --- a/drivers/i2c/busses/i2c-nvidia-gpu.c +++ b/drivers/i2c/busses/i2c-nvidia-gpu.c @@ -277,10 +277,7 @@ static int gpu_populate_client(struct gpu_i2c_dev *i2cd, int irq) i2cd->gpu_ccgx_ucsi->irq = irq; i2cd->gpu_ccgx_ucsi->properties = ccgx_props; i2cd->ccgx_client = i2c_new_client_device(&i2cd->adapter, i2cd->gpu_ccgx_ucsi); - if (IS_ERR(i2cd->ccgx_client)) - return PTR_ERR(i2cd->ccgx_client); - - return 0; + return PTR_ERR_OR_ZERO(i2cd->ccgx_client); } static int gpu_i2c_probe(struct pci_dev *pdev, const struct pci_device_id *id)