Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1764522rdb; Thu, 7 Dec 2023 08:11:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxOq/lO0BOVoY+2b1cMrmCCEiZLH6e3aGJw6/Gk967X5CAQDBMpgwpqYFHRgqnSFKYrk2e X-Received: by 2002:a17:90b:38d1:b0:285:d550:994b with SMTP id nn17-20020a17090b38d100b00285d550994bmr2473004pjb.40.1701965514727; Thu, 07 Dec 2023 08:11:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701965514; cv=none; d=google.com; s=arc-20160816; b=Qgut7/7H1PeMw/4LJQnzjpXKhrKNuHMmeFlJtDXBaacMCfQayXvXbr0eJsFwNCTSPh kDcKLoIQi1VXP8/DOKyeT0Al9luYd4y8DRh0AZafDj0usfhrJNDijxmsZe4daee0s0me otvfHsBs+3fVq+YGI5Sy30dE39Cqo9TMhQX35U6yQe/GKuZU066aXCT/EffGR0NLdZjl jjV4Il0URHpy0peWsuVUjUGdsqMKLtT3svCO/qWVhlNMimugbbpd4r0vfJuqPxANnZFp DaQY9PXCn84YSaMMjQUHAIcIYEHGqJkrWmH9kxHxwSIp78GQx7X0Si8Pgg/DRSDd2c75 kIkQ== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Go2gENvTwNKW6ZCLnJftZqDOBK9sXFTrSP+ODQQOw/I=; fh=7Cb5YHqGdW7ZzP5NmcwBWZkKctF5q3WRAC3DuJdGgaY=; b=LHX32H1ybtt173QA/D2dcAa5oNAlDGrZwC2CsalSfbJwMSyB1HlC1GkAWN1gJ0ctfd OZR0N7I1ztY2KnC7xtVZwABad5oJga1dZc8qK3+UMp5Gq5JB4cJVWmeEBpMxjdvBS1SA Py4kRqEZxBjxnwVI0ZXE/NsRel2QlRcXO4NeGHcSheT6wW5o1OqohVj72xkJ91JXwo3C WoEmYNC3j3kqqgnZom1IIWTrcJeyDTLSVILWiNxN0mN5tbtahhb2qFrOGAYai0FQU1gK cOOuy4yXtFp+wXdL5nqi7K8CC43Fxu082HDveM5a08QD8EDTB0WEJ/aXE5Ys+uB7QmzB 7tiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dZzWK5JR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id lk7-20020a17090b33c700b00286c59061e7si1301556pjb.122.2023.12.07.08.11.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 08:11:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dZzWK5JR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3B49D80792E1; Thu, 7 Dec 2023 08:10:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232570AbjLGQKh (ORCPT + 99 others); Thu, 7 Dec 2023 11:10:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232358AbjLGQKg (ORCPT ); Thu, 7 Dec 2023 11:10:36 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05A1284 for ; Thu, 7 Dec 2023 08:10:42 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BE9CC433C8; Thu, 7 Dec 2023 16:10:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701965441; bh=F9jvVm4Xw/p4U6hdGC3086OM1LmvQJua8bhrbGVSwCM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dZzWK5JRmFVCcZOjYN86lmpWzPq2AWQGQjfmSAYhjdi189K2Fnvuo5itPQU+PqFU8 Z9VJfw88x0AQVscIPQmRyrOudv+vd7tsKBFL3NDICK+tQN2aufJJRIfw9X4ttqwmdt hj+EJxyOZ8oDpwivD1zh0rdV5yz7tHGY5MaxoV2X1Q7R3Ov1ZKlMFSF41/d2woB7p8 512pMsymUMGsdxYrD76TVeDG0phxI0qEOvCqU8hxUFfDgotQxG16gzF5uL5pTPaDRb FDSo3mE5ysR9PjLl5zFwKDoc/nn+HLz5aVrxdh3tH0zCV1dbG8ytegL7vXLaIYw7nK 1O2q7Xe54S7hg== Date: Thu, 7 Dec 2023 16:10:37 +0000 From: Lee Jones To: Kunwu Chan Cc: jpanis@baylibre.com, kunwu.chan@hotmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mfd: tps6594: Add null pointer check to tps6594_device_init Message-ID: <20231207161037.GA111411@google.com> References: <20231205095426.2532572-1-chentao@kylinos.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231205095426.2532572-1-chentao@kylinos.cn> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 07 Dec 2023 08:10:57 -0800 (PST) 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 > -- Lee Jones [李琼斯]