Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2439704pxj; Sat, 22 May 2021 23:58:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlSJjxj3ffjTzrvkD/ad6kqy/wlT0Oo0li959VFXHCYBDWvSOk9alc2m/CvdBIdMgcTFvU X-Received: by 2002:a17:906:eb0c:: with SMTP id mb12mr17577397ejb.109.1621753118494; Sat, 22 May 2021 23:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621753118; cv=none; d=google.com; s=arc-20160816; b=JIX0X1k5H69Lc1RoC1ClytJu2kSZKZqmSapTx0HAhWzr2/Du1Ivk46B9e7d4VQPKps Q0cqByRoAeviyPl25m9Jkg5799+5g6Ep69ZTucep4YkfB0/LsVXzC+YIoVf/wVTUuMk5 GnWv+3EkJ7EnjA2yFPMTyZ6+L3YaviFrq145gJ7j/TaRig2GiEoByRExlTyM/WW5WO63 GOiaBmh5g96lDQhWbPNv/xnwNdeZg7lzgdtS1QkUY5zuzDahNaQDaDafGh13GbpXSBT5 Q1LbswbE6jfZruDnXUprdXtfuDUpcyTnNLgX8SYF1LqCYa6we7Fh1RB4jSNLbNfQCj2F pwOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=Zbus+37wKyBlR7sV8CB/7DVOqvtFW4+6hQ3Jx8bGVdU=; b=0BxwTpMU0hz+uKV28OJ1eSy5M8W+DXeA3rpdAGRhYihAax8nNEiMoGvKNUYPZdv2mI B18AsN3s85Y8an4w3kA3JX+Ny7FlqEfkN3xcGNm0new9INk8OuzKeLFHadjia67NKy1P SY3prt7/0qJ6mR/iHM7lVSCLHK8FMf9VckAHrOCHoxPw/3GpV55opKYqhjigismCn4wi SP0ucAfzywMfl1XmtWa4hSiSj7dcKMw9MrWl4FlVX24b9pwGyYb/oUgzRJmiWclz4G9c Fzcn3Cw1rDUJCKVE/LtDMt2FMcsL5ris/yzVsiupjLWjX6TKgEbxsd/+iCY/CWCBKuFR fBCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nb27si9524225ejc.548.2021.05.22.23.57.51; Sat, 22 May 2021 23:58:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231591AbhEWGfG (ORCPT + 99 others); Sun, 23 May 2021 02:35:06 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:3657 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231555AbhEWGfG (ORCPT ); Sun, 23 May 2021 02:35:06 -0400 Received: from dggems701-chm.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Fnr8R04hvzmWf6; Sun, 23 May 2021 14:31:19 +0800 (CST) Received: from dggema769-chm.china.huawei.com (10.1.198.211) by dggems701-chm.china.huawei.com (10.3.19.178) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Sun, 23 May 2021 14:33:37 +0800 Received: from [10.174.179.215] (10.174.179.215) by dggema769-chm.china.huawei.com (10.1.198.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Sun, 23 May 2021 14:33:37 +0800 Subject: Re: [PATCH -next] USB: gadget: f_fs: Use ERR_CAST instead of ERR_PTR(PTR_ERR(...)) To: Greg KH CC: , , References: <20210519023032.19812-1-yuehaibing@huawei.com> From: YueHaibing Message-ID: <91b40f9e-9de2-0d16-7eb1-50e5a91fb077@huawei.com> Date: Sun, 23 May 2021 14:33:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.215] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggema769-chm.china.huawei.com (10.1.198.211) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/5/21 19:48, Greg KH wrote: > On Wed, May 19, 2021 at 10:30:32AM +0800, YueHaibing wrote: >> A coccicheck run provided information like the following. >> >> ./drivers/usb/gadget/function/f_fs.c:3832:9-16: >> WARNING: ERR_CAST can be used with data >> >> Use ERR_CAST to fix this. >> >> Signed-off-by: YueHaibing >> --- >> drivers/usb/gadget/function/f_fs.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c >> index bf109191659a..61110ff52f49 100644 >> --- a/drivers/usb/gadget/function/f_fs.c >> +++ b/drivers/usb/gadget/function/f_fs.c >> @@ -3829,7 +3829,7 @@ static char *ffs_prepare_buffer(const char __user *buf, size_t len) >> >> data = memdup_user(buf, len); >> if (IS_ERR(data)) >> - return ERR_PTR(PTR_ERR(data)); >> + return ERR_CAST(data); > > This should just be: > return PTR_ERR(data); > right? ffs_prepare_buffer() should return an ERR_PTR() encoded error code on failure, maybe there just do: return data; > > No need for 2 casts to happen here. > > thanks, > > greg k-h > . >