Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3932779rwe; Tue, 30 Aug 2022 01:06:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR5l0i6OsPtv58RE1ClE2DeVG/A7GhpYTB4IXEbFnIVPuEenGDoB8KUV2g2hmbs9/NTJLIsD X-Received: by 2002:a17:902:d509:b0:16f:1e1:2063 with SMTP id b9-20020a170902d50900b0016f01e12063mr20006387plg.131.1661846810616; Tue, 30 Aug 2022 01:06:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661846810; cv=none; d=google.com; s=arc-20160816; b=D5Z6tOFNv0e8eqBXXQFGW+hqPltzCELh5mMFolyhyTxqEMjiKX00ZQxbI8f+Euo9pQ fPZX9vf6AWJst9l/PQwHXDk31JjLjVFTG2gKMC1FVb83ZJI3++GMdejTSIeADTfinqLv TbmFQZPcBcyacvoKY6msicXQLJJ48TWnYT+T+mRVZpFc6bPa4N0gKvFbjTy5lZVe8Trj u5S3kVA3tH2oN3nc3n0HUCp25lbhrzKLonHI7kmGDOed8UnNND6t0/BJH9x58TcZmSOt 2yfs/M0HwWv74wZyOdwlVJQU4FZfCWLaGDN7ngcl0i81kACH6jy4dfP16gQTnkHxT/oM gi4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XXo1m7KYIATOQ6yPMJMNKpEYOzl7wuF09/2UZEQMsUg=; b=iJhF2aAs9S3oyVc8qkbXlfKM+P/FPRBNQ8Z4sZhfMMjtQqGEiD9lPoEF7omeawMhTC 0/9Jv5ALisMrXB1mZnKRTRTnyO1amir8f636ouwGFA1w43nbJbwO/64xLAfyCS8MTn/U wnabWCwAFGe9yxHivD2By42c4rtWlY/MJbD5pHJTbBiT46iTIOxkViGk7IyZYHDl/st0 fM0YvEmPuvSKLq8lvvxCgv462u4J4UTJPEKe+aeTgJJ9M+djFUrNPck19J5K383J07CJ qhCB+Ogb5kZDByMna4KvnNJ/HRr4JB1JEO/ipuQfEVw+P1nRiGUnmXzd8i34eQT3Ecvw uvGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cTqkeBK2; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v27-20020a63151b000000b0042a39b56e98si1570540pgl.389.2022.08.30.01.06.40; Tue, 30 Aug 2022 01:06:50 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=cTqkeBK2; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230212AbiH3HT6 (ORCPT + 99 others); Tue, 30 Aug 2022 03:19:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229823AbiH3HT4 (ORCPT ); Tue, 30 Aug 2022 03:19:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1C37631D; Tue, 30 Aug 2022 00:19:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0FEB861466; Tue, 30 Aug 2022 07:19:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E168BC433C1; Tue, 30 Aug 2022 07:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661843993; bh=cNl2q6IwhNO1r/WX6/JP3SlN458v5wTt/geQej7BrCw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cTqkeBK2Wg4Rjz1Qdp1w2nJSsduJhiCv9dfwLA5MTJbuLRYnz3vtqKk3Ldhsq8yHt SLjbHymv3AUeKCudBUL0w9+QrRSGhOp0Pe+G1dU+OyZXinKR/qYKdn+u+0aMu2UjoM kClNAemEplLWLVZj8OZiYKcakpRJmDoVBnOiEbjLi2BWvWRSascb7QAbZRgGpLBx8g E69cPMRPj5GnhVphavfGEp2IF/7TpKG9KRDaMqR6XZnRVBGsEX9whTEaBJDGqKJxYA PXn3EqzZEabPnnBGZYXwnDXnAv+iiBKANwm5sTNPFCkrS7bTnADuBdzxAMtyp0pbFM HPw0ydz2KqMLA== Date: Tue, 30 Aug 2022 12:49:49 +0530 From: Vinod Koul To: williamsukatube@163.com Cc: linux-phy@lists.infradead.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, jckuo@nvidia.com, kishon@ti.com, thierry.reding@gmail.com, jonathanh@nvidia.com, William Dean , Hacash Robot Subject: Re: [PATCH] phy: tegra: xusb: check the return value of devm_kzalloc() in tegra_xusb_setup_usb_role_switch() Message-ID: References: <20220723034130.2952016-1-williamsukatube@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220723034130.2952016-1-williamsukatube@163.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On 23-07-22, 11:41, williamsukatube@163.com wrote: > From: William Dean > > The function devm_kzalloc() in tegra_xusb_setup_usb_role_switch() > can fail, so its return value should be checked. > > Fixes: f67213cee2b35 ("phy: tegra: xusb: Add usb-role-switch support") > Reported-by: Hacash Robot Where is this bug report? > Signed-off-by: William Dean > --- > drivers/phy/tegra/xusb.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c > index aa5237eacd29..e3611fb4c779 100644 > --- a/drivers/phy/tegra/xusb.c > +++ b/drivers/phy/tegra/xusb.c > @@ -668,6 +668,8 @@ static int tegra_xusb_setup_usb_role_switch(struct tegra_xusb_port *port) > port->dev.driver = devm_kzalloc(&port->dev, > sizeof(struct device_driver), > GFP_KERNEL); > + if (!port->dev.driver) > + return -ENOMEM; > port->dev.driver->owner = THIS_MODULE; > > port->usb_role_sw = usb_role_switch_register(&port->dev, > -- > 2.25.1 -- ~Vinod