Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2093490rdb; Thu, 7 Dec 2023 19:25:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IFmKWqrPJplniJ6cADfIogG0GTOLHD5MvAGbIlcnAy4URnPthDaCD2bjgBN2v8gBy2Cq8yd X-Received: by 2002:a17:90b:4ac4:b0:286:529e:699 with SMTP id mh4-20020a17090b4ac400b00286529e0699mr2978227pjb.0.1702005903904; Thu, 07 Dec 2023 19:25:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702005903; cv=none; d=google.com; s=arc-20160816; b=iXixGwDbN91d4XqGYeIz5u+J+JBp1+eIqwdqEzRtdh73Ji+uQLTXu60iidc+CbrBSQ 4TLkkc3ehfArQ5rttEXBy5iDjQQ0nkrjr1Jx9bZD7UBZN4aEZRTFHcZCOjek+YGkN60S WUoQ7cahQrUBabQcbHKrlIMYB4fyVYBJv9OmWyfGTSqMZ5T+7kft4pM4/+Fw5qLaSwyI JE7I9lO+tJM3Qc/v8DvLX6GN6wXdfBQ7TDypk3/q9jWpCU1Mux/FpQOsV3imuPMHeFgh 0eP/YxwiElqMdd4HjJ/vRqXtKKltcRAtAcT8mJvJfIIJU650xcKrkWbxSusN1XRw8onD hfoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=TSwlk77KLoHWNkI5ykxfNLfWDEU1SWnXR6nr7L1wTFk=; fh=m2SSp2OUEi1ENyGlQUt1AlravXSPA9dmp64nPdu+CuM=; b=WOipEI9ltYShe4TbYcduLdFkCRKB37wFo4RItMypiy7FDy3QRkPtfCVGWV7GgVG+ei uirM3TuR04wYp2yz65cH6UmUUqxOvuZEd8eTCuk0W7zOoICLuoec/MWSxNb0F5VBEGIB /V4roqpuENL2ZRAmsm8fWnrNP4KEZJ0/MVaFXHTmvlOobhM3EDFs4E1E1kTDlYBJABOG MUyyRTxDJlaTOT4aJgWGk9MFbX66bg7/l1x452l8ZEBIV9TtPqqwQhocLtEP/x2AmkWm Lyv2xw61F9wW27QlzaDSpQO4DvQ1N1KNAwieCnCSvMulghwbzTEA2ysE849SI7R/11GH DRKA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id cu21-20020a17090afa9500b00286bd6b361csi2161917pjb.110.2023.12.07.19.25.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 19:25:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id BDA5180732BE; Thu, 7 Dec 2023 19:25:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235374AbjLHDYt (ORCPT + 99 others); Thu, 7 Dec 2023 22:24:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229531AbjLHDYs (ORCPT ); Thu, 7 Dec 2023 22:24:48 -0500 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 413E510CA for ; Thu, 7 Dec 2023 19:24:54 -0800 (PST) X-UUID: 76c0787f61094e8998249a46e8114759-20231208 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.33,REQID:63b3e073-6b38-45fa-875c-3be5f66d8c26,IP:5,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:-15 X-CID-INFO: VERSION:1.1.33,REQID:63b3e073-6b38-45fa-875c-3be5f66d8c26,IP:5,URL :0,TC:0,Content:-5,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-15 X-CID-META: VersionHash:364b77b,CLOUDID:ed9e8b73-1bd3-4f48-b671-ada88705968c,B ulkID:231208001052E1RKQQ2T,BulkQuantity:9,Recheck:0,SF:44|64|66|24|17|19|1 02,TC:nil,Content:0,EDM:-3,IP:-2,URL:11|1,File:nil,Bulk:40,QS:nil,BEC:nil, COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_ULN,TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD, TF_CID_SPAM_FSI X-UUID: 76c0787f61094e8998249a46e8114759-20231208 X-User: chentao@kylinos.cn Received: from [172.20.15.254] [(116.128.244.169)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 2075006423; Fri, 08 Dec 2023 11:24:49 +0800 Message-ID: <12be2a40-0952-4577-80a0-fec688769230@kylinos.cn> Date: Fri, 8 Dec 2023 11:24:49 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mfd: tps6594: Add null pointer check to tps6594_device_init Content-Language: en-US To: Lee Jones Cc: jpanis@baylibre.com, kunwu.chan@hotmail.com, linux-kernel@vger.kernel.org References: <20231205095426.2532572-1-chentao@kylinos.cn> <20231207161037.GA111411@google.com> From: Kunwu Chan In-Reply-To: <20231207161037.GA111411@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 07 Dec 2023 19:25:01 -0800 (PST) Thanks for your reply. I'll update the v2 patch: 1. When 'tps6594_irq_chip.name' is null,just return -ENOMEM. Thanks again, Kunwu On 2023/12/8 00:10, Lee Jones wrote: > On Tue, 05 Dec 2023, Kunwu Chan wrote: > >> devm_kasprintf() returns a pointer to dynamically allocated memory >> which can be NULL upon failure. >> >> Fixes: 325bec7157b3 ("mfd: tps6594: Add driver for TI TPS6594 PMIC") >> Signed-off-by: Kunwu Chan >> --- >> drivers/mfd/tps6594-core.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/drivers/mfd/tps6594-core.c b/drivers/mfd/tps6594-core.c >> index 0fb9c5cf213a..6403c1063de9 100644 >> --- a/drivers/mfd/tps6594-core.c >> +++ b/drivers/mfd/tps6594-core.c >> @@ -433,6 +433,9 @@ int tps6594_device_init(struct tps6594 *tps, bool enable_crc) >> tps6594_irq_chip.name = devm_kasprintf(dev, GFP_KERNEL, "%s-%ld-0x%02x", >> dev->driver->name, tps->chip_id, tps->reg); >> >> + if (!tps6594_irq_chip.name) >> + return dev_err_probe(dev, -ENOMEM, "Failed to allocate memory\n"); >> + > > The check is fine, but the use of dev_err_probe() is not. > > Simply: > > return -ENOMEM; > >> ret = devm_regmap_add_irq_chip(dev, tps->regmap, tps->irq, IRQF_SHARED | IRQF_ONESHOT, >> 0, &tps6594_irq_chip, &tps->irq_data); >> if (ret) >> -- >> 2.34.1 >> >