Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp169997rdb; Tue, 5 Dec 2023 01:55:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IGjxPLPABYWggmjVd9E/C77VycHCbUJy6fN2G9f99ULGclJISCokzdtJXkTmpBjnbbHENgC X-Received: by 2002:a17:902:e5c6:b0:1d0:cd48:e05c with SMTP id u6-20020a170902e5c600b001d0cd48e05cmr94754plf.75.1701770103562; Tue, 05 Dec 2023 01:55:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701770103; cv=none; d=google.com; s=arc-20160816; b=lLnAz/L81hU7wKtfEG5Olf2UOySwlUE6WHDVeb48RHrh1djYMJTEp8HjdqUUi8+hgB VyxT4UsooAzdkbTnd6U77nG6LjumcH/zyoKFRP6cFPX1dsDKm2Ayrsyes8JE7lqDZEyl CWr+r72VNnTLQiDz8hPJbXPZB0JZX2SVoxxUpoe2apA/09EX3+CzzU84JJ6rKMgT+C2W caToHSjpHSnOVIih7314j6TobNGWkRgoKOygL+OFC35M7vfN/ISUwgcbnZ8UkIfUd1KC CqeuD5e8ymqEaUemK/q3BCxNHAJcydnRYlmbko+ZVBNqLdCM0yPyOZq8Z75AYsHv+E+d uexA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=zlOPL1MZ6lizS91wiNoG9lQGUjedmFCgwBtXLnpGxH0=; fh=kafFTtmZ7WimRvHL6gXGDtDQiejr2uF68zoUoJyltPI=; b=x/N6Zy40nT4JDm05IxSP3ugdiJj13zPlDlBv92376AqfsYDcE7RVa87Hsa6pPH03XB 91T60oKfDoOp01a/nDKAJq9UV84YDUn5QYzew5IFXF9TpvCgmVqf/sgatO7W1dXSWKMd xlGLJ40rziHMJomr2vtuOqDVmSj9+XFFm025IbwIvrV4fosmzU0cTLXO3A5jqh30s1pt n0EW0fGU3q40ij0FBgkfJewWJd5PD6ZybqYPEm9BHosv87v8aREA+17zOL7kBOFoSUJb j7LHj9KkeFWBj/frDPe3Km3DtkiJ1t4Te+tqtL9gjIHHcdAKtdi3RViz29Q8Mu8sN3YL RJmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id jd9-20020a170903260900b001d00a56b03asi2655252plb.337.2023.12.05.01.55.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 01:55:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 22A90801B3CD; Tue, 5 Dec 2023 01:55:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231985AbjLEJym (ORCPT + 99 others); Tue, 5 Dec 2023 04:54:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231778AbjLEJyk (ORCPT ); Tue, 5 Dec 2023 04:54:40 -0500 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBFA3A0 for ; Tue, 5 Dec 2023 01:54:42 -0800 (PST) X-UUID: b2407895826d455a82f51e78dde214d5-20231205 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.33,REQID:008bd453-063f-477c-bfc1-cfc48fc8515e,IP:15, URL:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-INFO: VERSION:1.1.33,REQID:008bd453-063f-477c-bfc1-cfc48fc8515e,IP:15,UR L:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:0 X-CID-META: VersionHash:364b77b,CLOUDID:4854d660-c89d-4129-91cb-8ebfae4653fc,B ulkID:231205175432WVWISN0S,BulkQuantity:0,Recheck:0,SF:24|17|19|44|66|38|1 02,TC:nil,Content:0,EDM:-3,IP:-2,URL:11|1,File:nil,Bulk:nil,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_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI, TF_CID_SPAM_ULN X-UUID: b2407895826d455a82f51e78dde214d5-20231205 X-User: chentao@kylinos.cn Received: from vt.. [(116.128.244.169)] by mailgw (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2087088917; Tue, 05 Dec 2023 17:54:30 +0800 From: Kunwu Chan To: lee@kernel.org, jpanis@baylibre.com Cc: kunwu.chan@hotmail.com, linux-kernel@vger.kernel.org, Kunwu Chan Subject: [PATCH] mfd: tps6594: Add null pointer check to tps6594_device_init Date: Tue, 5 Dec 2023 17:54:26 +0800 Message-Id: <20231205095426.2532572-1-chentao@kylinos.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Tue, 05 Dec 2023 01:55:00 -0800 (PST) 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"); + 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