From patchwork Wed Jul 6 14:26:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 588420 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 762CBCCA473 for ; Wed, 6 Jul 2022 14:27:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233026AbiGFO1Q (ORCPT ); Wed, 6 Jul 2022 10:27:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232469AbiGFO1Q (ORCPT ); Wed, 6 Jul 2022 10:27:16 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D98720F75; Wed, 6 Jul 2022 07:27:15 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 266E4alg009659; Wed, 6 Jul 2022 14:27:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : mime-version; s=corp-2021-07-09; bh=Rjxzm3ckdi8sqaRWhhfLeeC68AZnMeSDIKBFRakrxgQ=; b=mQn+vUSqnDpZ9wQhlBOic8VecygQ5j2MF6UQGwnWOx7+oZt7ef/orQvqGMM2KsKa1rtz jGuwPQkRVxlncSQ4AplZSfXYlBOtDKm5HzdW8D+iMRuj2BTP2PkRXkOxmQ6RL0h04wY2 tT/d0HmnTx+6CJWwPASNXckPArE4OH3/gj+jmE3fJA1RwGRDKlWgdN3tApgWFXnVotJC OzKjCfEO2rA/aeAIh7DcRKuxg+oSuokGDM94k1vGK4h+yGxHHyof/K6GoKbFDGlU7Fpy WZ27nnj794raO8synkxddwKATHDwlPjIqzSesjbs12/TLtd9lVowPh5EE6rkOeRsS1/R xw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3h4ubya66e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 06 Jul 2022 14:27:09 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 266EFIvb015471; Wed, 6 Jul 2022 14:27:08 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2047.outbound.protection.outlook.com [104.47.66.47]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3h4ud5uks9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 06 Jul 2022 14:27:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J63YhcFFjpQHji2k7fhZEzZH+MCAvBFHlgFUQCjFY5FePofWFQqYSHMsaylRI5d5fxaYDCyBI5t5fKRovKULkgrI/ZQGEfkbO9Oeo/qP56oxlaFfaZF1pQo6/chNhO+OuU2XV8Vb6+1u1fOzn93Kze4uzl44OBVm5u973sLMGeOjonPCXCR+A9mVLDmo6Tni5dW1CtO25vldf2BdVuHa+JEbEXhr83Z3IxBnoRLxnXg+OOG79HL3i8WC8jdP63KKFzsSvws0dPaSFrXGYh4Ecw4YI88vuLsV5ua1MvXYMzXGxGiWUqfCmtSpf8kdedYcKoyytAyo0r+aDNVXiKQvZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Rjxzm3ckdi8sqaRWhhfLeeC68AZnMeSDIKBFRakrxgQ=; b=hs5wVA4dCSGGsK7zQPC6NyQ8uPUrJm5DyrlNyffOr8mwVP1BQixejctFjS3PTIKM6qWkLZ7VT0WLTiYYEGewJYTM6H1HRT2/jGtOTsnEjLATjZfd0ave33/anXP8IeVPeSiE03pFLvJMkfqozlP59RvGYz7hUbWKPmzHDFD92vRDSgSWSHMy5R6vXYavUnkTqkiAZPxK6HLRcNb8eaBFD2wJlzHuTEBo+dd9XK0vmtaSNm9bKKfuchoJYAqDa/l4AMkPywjlfFr4gffzL1eLWBI838pXRffJr7WfWTNfg6BcdsVe7UWWUwknERVn7L34L6K+ihgSUVH5OneeMq6muA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Rjxzm3ckdi8sqaRWhhfLeeC68AZnMeSDIKBFRakrxgQ=; b=YqYUhPPfAtl8a/e12hePot+W1vOJQnQ5KKaxeJVvDq5YT3nC4yCTo9ZU5K4WdFNVBF1WSMUVQflXMUyNlD+JnP90h8CA5tUKKhCsh3Q7sl0rkb3rUYd2BCrhMOHE/ymV5fumLlc4Tour3bLW12o8/9OviDpKHwVhbQZM1lKYIg4= Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by PH7PR10MB5813.namprd10.prod.outlook.com (2603:10b6:510:132::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.21; Wed, 6 Jul 2022 14:27:06 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::5020:9b82:5917:40b]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::5020:9b82:5917:40b%6]) with mapi id 15.20.5395.022; Wed, 6 Jul 2022 14:27:06 +0000 Date: Wed, 6 Jul 2022 17:26:56 +0300 From: Dan Carpenter To: "Rafael J. Wysocki" , Cristian Marussi Cc: Sudeep Holla , linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/2] powercap: arm_scmi: Fix signedness bug in probe Message-ID: Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-ClientProxiedBy: ZR0P278CA0021.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:1c::8) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2222be65-8711-4c44-64d1-08da5f5b9a16 X-MS-TrafficTypeDiagnostic: PH7PR10MB5813:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4yYhHdAT3IhClx6r3krScYJVLK4IVMJCcSoFaoQQlBigmic2spp4nEgw4s9DDhGkIxsr1gCaFe2g8xc6f3rXc00NidqIF26p11keAOphChBC/h3/gCjGuetNdodN1IJLt9YliOX1a4P/Z2RXynKDqvf5XZz88N/NL2PoyItg0KQ1Ov6Gc7yuSitdk2ve0V5k616ArB5YVDz102IQBFW1SkfNL5m8SlNWlhiim4dmFSHGnrJrhczlny4mQ3rV5bLlAlYSzgjAB7uBwwgHwpSoxkbHPzmPIfcBLMVyYObNDIf5J4KGQvlTMeSJvfy2c2CPRYrVrUwRsHuqsZEGxsCi5UWWiOA5V32P32c8pYPQ3KoUSdGGhKLXVe55orH0Vq3J2duXg/JtpSZk6n7a7x/OupOiIoMegdxtUfPVsy/Lhtg8fR2M8drKKdY9qGOkKX1ew92wyh9xLjHu8FJrKS757xydW7LJwG5XX71Nmg5wm0QKHDuKcHLC4+s9uFBDENrt+wFv7Ud7sWxIWkJKjtGNRDJSHe2Xxdbr9fj8Zh1TlQvXyhgvjy8ytaZ+j8/gEwRDt9JXBlAUdy1wZMlGupkZ904XATfQ+vx9teWWS1d7MERXH234k8CF4koO4AEQ0lRbkmZrSfQjdMpduVtUc5eme0g/WK7HxKo/DRNWRIr43H6DwL4S8bzEF/Y1Yv9i27FRPuNB8rYEGop2nJpdCVrx22EDqp8P37vspNXmt2tWHDHHx06YFBfBMDZeM8RvUPUKj9zdLhn8rvu2jxLyAnYzdmni+i04kPlUZmO2N5uApshL/8xFt+K7sD2ryYqLF7KN X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2365.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(7916004)(136003)(346002)(376002)(396003)(366004)(39860400002)(478600001)(38100700002)(38350700002)(6486002)(186003)(6506007)(41300700001)(6666004)(52116002)(110136005)(2906002)(66556008)(316002)(8936002)(5660300002)(44832011)(86362001)(4744005)(6512007)(26005)(9686003)(83380400001)(66946007)(66476007)(33716001)(4326008)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ckjWnfQnBB6ruMdnkzldYEDc/aFBOGrzDBUlzmKOd/rfvJl9+qaVsS7gXbVGwpBV02mjTavj1RZ1kW+wz/D6JLQCNQghAuXwtAiuuhq0xFJ91Uu23/Gm7AEHzl4grFO9ALd527IT8WlPdshhmNZuoGwGl5SNFbHqYPzbnmocGU58ChJg1wGXI1SRhEKHtKqJITxCfc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2ssbaEDiLF/29A+qpKrmUjb1S1N5mvTii8cWjUkv5mHeQcuafNIknAARh4lyTeDClzbxfLAnFqFsA+V7i8j6b+Hc1QP+BKvjzlbkAc4i9Qv2whSywYbdOSBcFAGBcRD9KR618u/ItbexCDnQ5Z8oD/E7eKUc+BSsmiWV64KqaTYwwrwIbiVO+a931dGEvZ/+TRnuU0Qmoaq0TduBFz3YRTiP4CuyREF2vpXJpnDHl31cw3YtFdfG2BrItHjIHJOO0x4RG5o92/O1VNJ7+mOJyZD2mf+3eTE6FscSKS/RtsXvW1MQlxgu6tqtlEndS8+iX+2fnNfVi3jA7okgrWmyRcEGsBuHQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2222be65-8711-4c44-64d1-08da5f5b9a16 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2022 14:27:06.1136 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: m0vhyWfUYZmIdzoTmgZh3iVC0Rk6RgYUotwm3ApzbFa7MMkXBAuiF8ugCbBleJsLK6Cck9TQU6oRZ/ZJgNUkwQMUBXZ12TnwsrCI7xqAgsM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB5813 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-07-06_08:2022-06-28, 2022-07-06 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 spamscore=0 adultscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207060057 X-Proofpoint-ORIG-GUID: um0tEGgFZlZeFgD6EXq4aIJGpe2Jl39g X-Proofpoint-GUID: um0tEGgFZlZeFgD6EXq4aIJGpe2Jl39g Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The "pr->num_zones" variable is an unsigned int so it can't be less than zero. Fixes: 31afdd34f2b9 ("powercap: arm_scmi: Add SCMI powercap based driver") Signed-off-by: Dan Carpenter --- drivers/powercap/arm_scmi_powercap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/powercap/arm_scmi_powercap.c b/drivers/powercap/arm_scmi_powercap.c index 2273768d70ce..ab96cf9a8604 100644 --- a/drivers/powercap/arm_scmi_powercap.c +++ b/drivers/powercap/arm_scmi_powercap.c @@ -425,11 +425,12 @@ static int scmi_powercap_probe(struct scmi_device *sdev) if (!pr) return -ENOMEM; - pr->num_zones = powercap_ops->num_domains_get(ph); - if (pr->num_zones < 0) { + ret = powercap_ops->num_domains_get(ph); + if (ret < 0) { dev_err(dev, "number of powercap domains not found\n"); - return pr->num_zones; + return ret; } + pr->num_zones = ret; pr->spzones = devm_kcalloc(dev, pr->num_zones, sizeof(*pr->spzones), GFP_KERNEL); From patchwork Wed Jul 6 14:27:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 587963 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD9EEC43334 for ; Wed, 6 Jul 2022 14:27:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231906AbiGFO1u (ORCPT ); Wed, 6 Jul 2022 10:27:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233460AbiGFO1u (ORCPT ); Wed, 6 Jul 2022 10:27:50 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E789C21E14; Wed, 6 Jul 2022 07:27:47 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 266E3ggd021463; Wed, 6 Jul 2022 14:27:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : in-reply-to : mime-version; s=corp-2021-07-09; bh=4SHq+Du6ohQxycotkTXGAVx2FxIHl893Wh2JIjbihMk=; b=FGwHs8KcafZn8iGop6tds8Wf+e53FOIufvYoUc4tLoq8jbxiq7cg5xvuDohfnBSfulWb 677moCvfX9f91vIHaAQww5wyB+6RwrUFuMg54nzr5nPkAbSbISZcBBMZr2kf0j56MgdH POOeLRD05TFTIt/vtZqo9IPzheahoAz3e/HUqfTfZ97VBd6jkX6GKtKQ9uuA0+BkBiWx TY7cZA/Q/rHOfaBLU0k02OLKXEn6biEzRv6FAWfn8NKpixdJC3v69IUk3GXKTEpwi4IY akpt+2iCtPwJ4x5u05XjQCn+mIFUgi5f1so8ONij70IjZ/o7z4M8ZpcLumev8LRHHOLj hg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3h4uby25pu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 06 Jul 2022 14:27:42 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 266EGxN6021079; Wed, 6 Jul 2022 14:27:41 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2044.outbound.protection.outlook.com [104.47.66.44]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3h4ud0v7sv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 06 Jul 2022 14:27:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gzJPVJSdsD3K75clRdUIp2o/pcgH6RHjK+inkKR/1uw//Ra8lcE0UkK6JFlM8rykf2tI0hN6GI7UCpQQWTk14tUC6TM+lzJw9jMMLC82pytwpCNbZeFrHQ9ckjl/JqpL4HmzGhjhvdSEZiaJJbfmYXXQigNy0fw+0TZidgIh6zKfTswhnE5Zetg1nfC9JPBJqMg9KfXAz7pDFk2ELqeQdAp7z39wKC7viuMG+LbEmuJX8+5oCOezZqkayVnlQ/KnioLJHa5FUG95DjMPXpVEJBPG8izWURUT4Qa6fcIeK792yBUwLMLHuI2OmHGqWNUb9F3HRsUoUUlRArXktmPloA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4SHq+Du6ohQxycotkTXGAVx2FxIHl893Wh2JIjbihMk=; b=JpOO+36ePVbUaFcWClMCYLjyzhNe+vH4zisHnrOXObg/9EdGQZJWLXQDC9iASt3yt8VSICL6zuPSN1ZkHuxViioRYiytf0WmAdL/1Qp8vTmS9nVKVn5rZjqVJA7eGVHOzH/kgexBCCZxNHY4MlH5Hvnai5FVab69TZDZ/MCYDQfVuTeiMskyZ3aZe8Cxj6DfZ0+D2Km1VjpnQvn9i7KOwpXYLZZKTn5Atc8LvPRdVz4WLD8noY2jTx9FMGGMx8mIGRG4gvIb12RXcesl5AJlIzqJvFbocx5kXZlTKkoLj7uTaqsJ0q5WYr0f8JiobPY1IwksvrhuG7cGP9coh3rhMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4SHq+Du6ohQxycotkTXGAVx2FxIHl893Wh2JIjbihMk=; b=vRu+1EH4TDuMEMWfvwoWqOUR7rBoEv5lP9EZD1EFDto+219vPoStEZ8FMMbifMI16N6FjiQVdKDWAk6Ic+ReNA2nSF+w1XvLhcCTkdB8m5vJuzzmBdaXqMa/M4QO8q+ShWFgKFO8sjIMT2l0guL3twqzSsmOVyVBGaDMUXJw65w= Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by PH7PR10MB5813.namprd10.prod.outlook.com (2603:10b6:510:132::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.21; Wed, 6 Jul 2022 14:27:39 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::5020:9b82:5917:40b]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::5020:9b82:5917:40b%6]) with mapi id 15.20.5395.022; Wed, 6 Jul 2022 14:27:39 +0000 Date: Wed, 6 Jul 2022 17:27:28 +0300 From: Dan Carpenter To: "Rafael J. Wysocki" , Cristian Marussi Cc: Sudeep Holla , linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 2/2] powercap: arm_scmi: Fix a NULL vs IS_ERR() bug Message-ID: Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email haha only kidding X-ClientProxiedBy: ZRAP278CA0002.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::12) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a93192d3-05b3-4c51-b5e0-08da5f5badb0 X-MS-TrafficTypeDiagnostic: PH7PR10MB5813:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z0AD/BArOcoc4/dhWg54KPDRp54SgATgbVmveQ+K1eXHCwd62auc+OSHucmpEyqkECP4dt1rU+UG+hYfKlPZ7SnPgZ8xxJVOCeeMGMSPK/GYpSBfVPgEJSsYW6JTlXNh74GiWujlizWYr4S32gIc2fY/XQtYBPsHRgwpDtC78La7Wu2ZIGlwyZvKvrR69phGTx/O9Lvf4J86KxzoMncJaotz0Mt6iAQHn4jsjrjCqbDjjm4JAZz9C1WlI1p0tqYGltmxGxBXzIUDKdhmc8bzlQ9EBnnC+67p1KKNDTnjt73Pa3wPxdqfvIeISLUM6KFoRa2m0OotLgGq2XNsTYTpEZKCN18Ncml/O8/axxJSX5CRFFzt8OxdfDc9CbQC2VOU5cXn9ow3AqcBD9Ph0PDXXrUyZ8XfTCO9uuUrNaffca4mJ5RVLNyK5zrbRMOyl2FYMIZsTbkCtHweMD4u61jltFMfta635lZwB52vnhP3jr4iAsmL8yzeS4/C0p6/nXlcjJSr/u17P7w7Xwe2rI8+JIvaF85C7+DCRTwdwDY2NbzbrLSm9NGjgMC+wMtl9uf58An4HfJBuM+agZ2zJRQuJ3Z5qunmYvilFrptg5lS3m1l63gJmGT3/MhD2B9spCfynxoGFOPuuUS21bAwX0QtqYEjG3Jh4FFj6G6Kjc5apUI7o2ZrUD+q5Ki7QgABD4jZJyQ7eZeJ1dtz4TyOa/Q1XvLD9SJnvQ0CnGv00DRVcwX1/H/WP+R/Po8wQfT/f524M8QUpGxJ8TlWE1XxyjlW1Mc1/cszklYToT9iG9hQ6W6hePR3d3lyuQvVo+fumS0ZwX04dcnzXKkYKgncOswaTg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2365.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(7916004)(136003)(346002)(376002)(396003)(366004)(39860400002)(478600001)(38100700002)(38350700002)(6486002)(186003)(6506007)(41300700001)(6666004)(52116002)(110136005)(2906002)(66556008)(316002)(8936002)(5660300002)(44832011)(86362001)(6512007)(26005)(9686003)(83380400001)(66946007)(66476007)(33716001)(4326008)(8676002)(67856001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +orFxSSa3x63AlfVSS75rPyPDekI2OUSD9tJN6DBh1ZjDoHFWHIEgbFbwMCpWeEWHzfhmBqVX6qyylLtsaIVQ/vzi6NyUGiL7T4QfHY8mnbH7yU1xHnbkP26izf+Dv9Lu2rZS39HS7aV8nq54aMEltctYwnBbdojBn2DzhXCVxLaQuaqF874G06c5xK8Zr0WSZU7BMC4soMtpTHCXMrw1CRqHki+JYNTThYXiM3cVKIHUf6XfIBu5sQ3rKt8W2tViR4r6YPCa8F9lfQwFJW/5fpns8ZaofMbKDTPxEoSgtGLHXZP1SDUUWyohC/dgXRrPtcD+Y82KubPHY20iNnZFkIQ51PsCrEm1xjVf7KB3RPiX5n2H2tR4nsKXvyrgcu03abVHVh7oOJpaj7OQ8nqE13JpWP651stqPx8JphPXtkLmjStjt/IaYQPgtGoS9Y1s5imJJWXAmMoE7X3I3E8+Dc6JFY+v40HVv7VxB9qLs0zi+/VCOYVhNzI62QcfexCBr9wpILxHowiTyBXDRrigNzIukxUxcVIymCSfcLhoDBKK7kovfvk9C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S-Exchange-CrossTenant-Network-Message-Id: a93192d3-05b3-4c51-b5e0-08da5f5badb0 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2022 14:27:39.0173 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OGAm1VPOlH3r5zLT5MpaiEFleekH2OViC8TDCNpEurtWhA64AUHACu1ZcJhsZTqAqE6L0FK4J0oKx1JfvRCv0IS6uKp7JbMexQDqWR3wg1Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB5813 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-07-06_08:2022-06-28, 2022-07-06 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207060057 X-Proofpoint-ORIG-GUID: gAWlqgS9cj6pGlhCHMqPhWK2XRXGgSJu X-Proofpoint-GUID: gAWlqgS9cj6pGlhCHMqPhWK2XRXGgSJu Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The powercap_register_control_type() return error pointers. It never returns NULL. Fixes: 31afdd34f2b9 ("powercap: arm_scmi: Add SCMI powercap based driver") Signed-off-by: Dan Carpenter --- This functions should really clean up after itself if scmi_register() fails. I need to fix the static checker for that and then I'll come back and fix it if no one else does. drivers/powercap/arm_scmi_powercap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/powercap/arm_scmi_powercap.c b/drivers/powercap/arm_scmi_powercap.c index ab96cf9a8604..2d505ec7ff81 100644 --- a/drivers/powercap/arm_scmi_powercap.c +++ b/drivers/powercap/arm_scmi_powercap.c @@ -519,8 +519,8 @@ static struct scmi_driver scmi_powercap_driver = { static int __init scmi_powercap_init(void) { scmi_top_pcntrl = powercap_register_control_type(NULL, "arm-scmi", NULL); - if (!scmi_top_pcntrl) - return -ENODEV; + if (IS_ERR(scmi_top_pcntrl)) + return PTR_ERR(scmi_top_pcntrl); return scmi_register(&scmi_powercap_driver); }