From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 847ABC00528 for ; Sat, 5 Aug 2023 02:46:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229696AbjHECqd (ORCPT ); Fri, 4 Aug 2023 22:46:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjHECqc (ORCPT ); Fri, 4 Aug 2023 22:46:32 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D08F4EDB for ; Fri, 4 Aug 2023 19:46:31 -0700 (PDT) Received: from kwepemi500008.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RHn202v2RztRsw; Sat, 5 Aug 2023 10:43:04 +0800 (CST) Received: from [10.67.109.254] (10.67.109.254) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 5 Aug 2023 10:46:28 +0800 Message-ID: Date: Sat, 5 Aug 2023 10:46:27 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH -next 5/5] USB: usbip: Remove an unnecessary NULL value Content-Language: en-US To: shuah , , , , , , , , , , , , , Shuah Khan References: <20230804093253.91647-1-ruanjinjie@huawei.com> <20230804093253.91647-6-ruanjinjie@huawei.com> <18553400-87e5-831f-322b-57b2e93244a7@kernel.org> From: Ruan Jinjie In-Reply-To: <18553400-87e5-831f-322b-57b2e93244a7@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.109.254] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500008.china.huawei.com (7.221.188.139) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On 2023/8/5 4:09, shuah wrote: > On 8/4/23 03:32, Ruan Jinjie wrote: >> The NULL initialization of the pointers assigned by kzalloc() first is >> not necessary, because if the kzalloc() failed, the pointers will be >> assigned NULL, otherwise it works as usual. so remove it. >> >> Signed-off-by: Ruan Jinjie >> --- >>   drivers/usb/usbip/vudc_dev.c | 2 +- >>   1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c >> index 2bc428f2e261..8e42839e6060 100644 >> --- a/drivers/usb/usbip/vudc_dev.c >> +++ b/drivers/usb/usbip/vudc_dev.c >> @@ -489,7 +489,7 @@ static void vudc_device_unusable(struct >> usbip_device *ud) >>     struct vudc_device *alloc_vudc_device(int devid) >>   { >> -    struct vudc_device *udc_dev = NULL; >> +    struct vudc_device *udc_dev; >>         udc_dev = kzalloc(sizeof(*udc_dev), GFP_KERNEL); >>       if (!udc_dev) > > In addition to this, make a change to return NULL instead > of going to out. > > if (!udc_dev) >                 goto out; Thank you! I'll research it and fix sooner. > > thanks, > -- Shuah >