Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2830935ybi; Sun, 26 May 2019 08:40:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEryAPs9sG+lVkhI28capP1+sSFakONBAsToRE/Rj3cpoxngc4+NO+fPSKA18D5UoqHbou X-Received: by 2002:a63:5c1a:: with SMTP id q26mr9790003pgb.260.1558885230298; Sun, 26 May 2019 08:40:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558885230; cv=none; d=google.com; s=arc-20160816; b=wnO79EeNCaDVTMP08XVCeM6syE52sX4ReVVXE/AG5DctziqsyDo4RVLxf/AFt8xEsh jXhidl6UTKE8k2aeUeKQrt662cwVfke/Gb/aSfZQqA6XPH7a4bjr+OUgzm8hjZLKx7S9 LWIGzBM5hmODAabiz66AAF87kHQ1lXYnyBmsMer9fylG++Y4spn7qKdbnviIoxxrDjMj 1xXiUpnVDbutFCzG+B7hhPOEuFLDcQXQC462eUtp+eHrqGc5qRgZAp2xGEYybuylBDJi jBkJkR9uZ+XU+JwJtGrzXfNxz+xPiCQI99hchWK5kxwU+D0av1tVgoHDjrZJND5PWLHs J9Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:to:subject; bh=URGml5/Z89pUst9mDYx5afNNgEbFqd7kb3vtTLohUmw=; b=Gj3OWGBCuL1H9s7K8g+M8F0uv3bauU7CsNsoF8flbBJcOaYaCD7BgWiq6YTBUVQ8hg +ThLUrTmEQtlrVdbbwrLtyyt8GG7nAljtIJYrf1721Ro0pNJyY2vTODQmBtsvozzxo23 xPowwU4/s7vCjR/fBCiIph75L/unUP4VNaxN4IBJ1vzJcNapRKBY5lfgn273H67qn/hl Q09OnAzpYDvqPtYOB1hX6aP4IAX1D7AaQLpKducf33XSUS9u3mPsGVB/norVfuER0VNv v6BqkMRy4qt9zkDycMw3FiZfAGcRhEGOcgAyt4rIvuwDGTOZUPWnIvK9qPPjWXyBi2v+ JMvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k17si756458pfa.128.2019.05.26.08.40.15; Sun, 26 May 2019 08:40:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727936AbfEZPhV (ORCPT + 99 others); Sun, 26 May 2019 11:37:21 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:46023 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726744AbfEZPhU (ORCPT ); Sun, 26 May 2019 11:37:20 -0400 Received: by mail-pg1-f196.google.com with SMTP id w34so2991225pga.12; Sun, 26 May 2019 08:37:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=URGml5/Z89pUst9mDYx5afNNgEbFqd7kb3vtTLohUmw=; b=En3WiXfP/CRsoLLfHEjTIRqYAnSZiZbZt2dd7wRCdiXQOUD0gI0JQF5qe/UivFYDBb Ds6OfpVH6kNISutLf5pnT2YqtJHVxK0YMIX6coCwI+NV41gvzgj7a2qUTPHsG/EDc3D3 TpeKsaDIiY3nhyfbZfumtz56NOh0ditZLsAn/nKEEhsdGZ/dklNmLzPIrIiUISeH5XdX JKDmWsQLIxtmo0BhivCdz1lYyzzxTrByYPcS81fevj+PQJ6CB2BBEqJth6vWFGJjc/Ep oKEHJhoMaQfqko5JTj0zxJEIAUdNCux2hhiEcwbXQQ/2ajaBIbAoAZLkwiYav1Tq8BdK LhWw== X-Gm-Message-State: APjAAAUvvcnkQqVqhL76xy3Kjikq/gfbzMHOcffgF1BpV0KD+OIj2Zgq OezbZtKxC1C6W/5iucSwWfW9LfCB X-Received: by 2002:a05:6a00:cc:: with SMTP id e12mr16068634pfj.207.1558885039820; Sun, 26 May 2019 08:37:19 -0700 (PDT) Received: from asus.site ([2601:647:4000:5dd1:a41e:80b4:deb3:fb66]) by smtp.gmail.com with ESMTPSA id t2sm8513249pfh.166.2019.05.26.08.37.17 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Sun, 26 May 2019 08:37:18 -0700 (PDT) Subject: Re: [PATCH] drivers/scsi: fix warning PTR_ERR_OR_ZERO can be used To: Hariprasad Kelam , qla2xxx-upstream@qlogic.com, "James E.J. Bottomley" , "Martin K. Petersen" , Alim Akhtar , Avri Altman , Pedro Sousa , Wei Li , Geng Jianfeng , Zang Leigang , Stanley Chu , Manivannan Sadhasivam , Kangjie Lu , Arnd Bergmann , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190525094205.GA21778@hari-Inspiron-1545> From: Bart Van Assche Openpgp: preference=signencrypt Autocrypt: addr=bvanassche@acm.org; prefer-encrypt=mutual; keydata= mQENBFSOu4oBCADcRWxVUvkkvRmmwTwIjIJvZOu6wNm+dz5AF4z0FHW2KNZL3oheO3P8UZWr LQOrCfRcK8e/sIs2Y2D3Lg/SL7qqbMehGEYcJptu6mKkywBfoYbtBkVoJ/jQsi2H0vBiiCOy fmxMHIPcYxaJdXxrOG2UO4B60Y/BzE6OrPDT44w4cZA9DH5xialliWU447Bts8TJNa3lZKS1 AvW1ZklbvJfAJJAw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3SQ8WVSXA9rrc4EBvZruWQ+5/zjVrhhfUAx12CzL4oQ9Ro2k45daYaonKTANYG22y //x8dLe2Fv1By4SKGhmzwH87uXxbTJAUxiWIi1np0z3/RDnoVyfmfbbL1DY7zf2hYXLLzsJR mSsED/1nlJ9Oq5fALdNEPgDyPUerqHxcmIub+pF0AzJoYHK5punqpqfGmqPbjxrJLPJfHVKy goMj5DlBMoYqEgpbwdUYkH6QdizJJCur4icy8GUNbisFYABeoJ91pnD4IGei3MTdvINSZI5e Message-ID: <2f7f51f7-e2a1-6667-3fed-642157437ea2@acm.org> Date: Sun, 26 May 2019 08:37:16 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190525094205.GA21778@hari-Inspiron-1545> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/25/19 2:42 AM, Hariprasad Kelam wrote: > fix below warnig reported by coccicheck > > /drivers/scsi/ufs/ufs-hisi.c:459:1-3: WARNING: PTR_ERR_OR_ZERO can be > used > ./drivers/scsi/qla2xxx/tcm_qla2xxx.c:1477:1-3: WARNING: PTR_ERR_OR_ZERO > can be used > > Signed-off-by: Hariprasad Kelam > --- > drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +--- > drivers/scsi/ufs/ufs-hisi.c | 4 +--- > 2 files changed, 2 insertions(+), 6 deletions(-) > > diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c > index ec9f199..4357b34 100644 > --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c > +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c > @@ -1474,10 +1474,8 @@ static int tcm_qla2xxx_check_initiator_node_acl( > sizeof(struct qla_tgt_cmd), > TARGET_PROT_ALL, port_name, > qlat_sess, tcm_qla2xxx_session_cb); > - if (IS_ERR(se_sess)) > - return PTR_ERR(se_sess); > > - return 0; > + return PTR_ERR_OR_ZERO(se_sess); > } > > static void tcm_qla2xxx_update_sess(struct fc_port *sess, port_id_t s_id, > diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c > index 7aed0a1..f506044 100644 > --- a/drivers/scsi/ufs/ufs-hisi.c > +++ b/drivers/scsi/ufs/ufs-hisi.c > @@ -456,10 +456,8 @@ static int ufs_hisi_get_resource(struct ufs_hisi_host *host) > /* get resource of ufs sys ctrl */ > mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); > host->ufs_sys_ctrl = devm_ioremap_resource(dev, mem_res); > - if (IS_ERR(host->ufs_sys_ctrl)) > - return PTR_ERR(host->ufs_sys_ctrl); > > - return 0; > + return PTR_ERR_OR_ZERO(host->ufs_sys_ctrl); > } Although I'm not sure this patch improves readability of the source code: Reviewed-by: Bart Van Assche