Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2691282rdb; Mon, 4 Dec 2023 05:07:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IHgHGYFwzioFrBIDgnubSSTbaaL/S61x5yJfeOpwY8wPTBiyankvQrHcz3IrEc3MJ0c+Q05 X-Received: by 2002:a92:c644:0:b0:35d:6916:aefa with SMTP id 4-20020a92c644000000b0035d6916aefamr2638088ill.6.1701695276132; Mon, 04 Dec 2023 05:07:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701695276; cv=none; d=google.com; s=arc-20160816; b=cYg85SiuSQJMQMuJPMakRvdNYFz1fRbEk7xiDwOJIm06QGLu/LhwAmrXm8EYUJwQNR bt9RktEEcZ3W4AHXClgeaYksxElnc1Pa+M3Bqe0UhLFbp9a3N7v9zVSUwq843cMAdw57 fPhAsUP3f985PHLOXv35IwbJOXMY+VtHqDzV8r4VfhI/gWqTr+WKZCehzOJV67zyQJ9k CVQqQ62Il12SvLXkBIUUuEUX8BfLFjNNExBp9m8VDe0ZAF9VtZrotLgqiJeYA745c7g2 /E+hJyNS+lwZcuDNNoxGrzjNnxFMAmP/6qj891w19NNDPyC+M0vSe2bWyxLoc9bG8Jcd kRgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=KtJMDieOcKOefc5gV1mATMIqoZuoXK1ac5IFBYDDa7Y=; fh=b03rU7xx3rIhIxyzj+nuRrVBZBwEjdJjjNYGXbeJkJ0=; b=fpCiOuJJ+rAPhy816qcebC9WJivILuOkvtdNJVjLGVg4MNmUJWXx0F8FtgGguKiI3s Gq11iV3nq8Bx7AF68dMItlDJSpBww5Gl+SXGIIGVJFp6WQfRvKNd+JUXDtoXjzbx1eBz +s+X67s3O25/r+4ZlLQz+rF4lvU/okMyiYMDau6xO92QHP0K370CMYwk+sk0zLmSrfdg bE9Sg64cbMIALw8mC35IgFI76PkcCNuH2VDoXb7aZpblki7rU054+I2FOpAquEQ9NmQv 9gDedzDkcENybYKQLOOoUVHYXs8/33wNERRlzhBoneRCdSGWllPyz6cCL7Rb8tKxytQc sN0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fsgXxWRQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id q63-20020a634342000000b005c252d169d7si7935780pga.704.2023.12.04.05.07.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 05:07:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fsgXxWRQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id CBB37805C148; Mon, 4 Dec 2023 05:07:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233206AbjLDNHf (ORCPT + 99 others); Mon, 4 Dec 2023 08:07:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232947AbjLDNHe (ORCPT ); Mon, 4 Dec 2023 08:07:34 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B717FA7; Mon, 4 Dec 2023 05:07:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701695260; x=1733231260; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=rwfeHVUdIJbFUBsUHDPSqcnPbouutdp0s8W6pWKb+Y4=; b=fsgXxWRQ89m4nUroXsW8cNZiVAFyIkyNiUyf+4W9A8wxcEl0dcf6/OHN 0lRvV3dfulQDh/7rnREljYFb4WFLZIENwuWIdDmwgTWUnxW7HzaIfl3ex ZN4S3/Cs0E2w8BFR/z1H2LmDf5gdeZLaBTckYzs/aDb9SqaJvY3TSf+hb O+j/bt9fJDxXaxXaLLf0RjuotT1CgRHXFb17dvQheY5hqmB4jsTvnl9N5 UTe3cthvCNNc47QmHS5r2FtuamSEk9RpQMiX4eIqHmgzvuPIckptx+4S/ AVrdwdq/WTKLP0x45BtoDcs6XuyybGFMqnhqGK7gXRvscfaja3sJcwCWQ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10913"; a="15275123" X-IronPort-AV: E=Sophos;i="6.04,249,1695711600"; d="scan'208";a="15275123" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 05:07:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10913"; a="861373354" X-IronPort-AV: E=Sophos;i="6.04,249,1695711600"; d="scan'208";a="861373354" Received: from malladhi-mobl.gar.corp.intel.com ([10.249.34.28]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 05:07:12 -0800 Date: Mon, 4 Dec 2023 15:07:06 +0200 (EET) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Vadim Pasternak cc: Kunwu Chan , "hdegoede@redhat.com" , "jdelvare@suse.com" , "linux@roeck-us.net" , Shravan Ramani , "jiri@resnulli.us" , "kunwu.chan@hotmail.com" , "platform-driver-x86@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-hwmon@vger.kernel.org" Subject: RE: [PATCH v2] platform/mellanox: Add some null/error pointer checks to mlxbf-pmc.c In-Reply-To: Message-ID: References: <20231201055447.2356001-1-chentao@kylinos.cn> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1694539297-1701695235=:3149" X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,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 agentk.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 (agentk.vger.email [0.0.0.0]); Mon, 04 Dec 2023 05:07:54 -0800 (PST) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1694539297-1701695235=:3149 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT > > Subject: [PATCH v2] platform/mellanox: Add some null/error pointer checks to > > mlxbf-pmc.c > > > > devm_kasprintf() returns a pointer to dynamically allocated memory which > > can be NULL upon failure. > > devm_hwmon_device_register_with_groups return a error pointer upon > > failure. > > > > Compile-tested only. > > > > Fixes: 1a218d312e65 ("platform/mellanox: mlxbf-pmc: Add Mellanox > > BlueField PMC driver") > > Suggested-by: Ilpo Järvinen > > Suggested-by: Vadim Pasternak > > Signed-off-by: Kunwu Chan > > Reviewed-by: Vadim Pasternak > > attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL, > > "enable"); > > + if (!attr->dev_attr.attr.name) > > + return -ENOMEM; > > pmc->hwmon_dev = devm_hwmon_device_register_with_groups( > > dev, "bfperf", pmc, pmc->groups); > > + if (IS_ERR(pmc->hwmon_dev)) > > + return PTR_ERR(pmc->hwmon_dev); Thank you both, applied to review-ilpo and will go into fixes branch once LKP has had its chance to build this. In the end, I decided to split the devm_kasprintf() and devm_hwmon_device_register_with_groups() changes into separate commits. -- i. --8323329-1694539297-1701695235=:3149--