From patchwork Thu Apr 21 15:49:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12821903 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A96A2C433F5 for ; Thu, 21 Apr 2022 15:49:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=KRR13aDIuSJRYyNihSWEERUfWa4pIjkK7UM9EN21i1U=; b=MSdiDU01LcDyQs zDI9yho71gqxIWT2aaltzllqWAIq+EYF9+OxRbGVSxOgN0pgKsXXRyqbAvguRoMcaj+DQ+mxhZhVW z0kcGGhA7Nbzh2JCGUUCYFny86A8F762Fd85i8Bh0aXtITZq8XzLMaRtB4GktH7h4fkZyT0rQ0CIg lSzQ4/MV1z8JRiFkCPG205vqWh0f9QEWWHykkFmPKWpzrO3689p6osjlGK8a13xdZ4tT1O4APZ7J2 DSegkzzmWy7WyT9OrfrUZon5+3F7D/A68Nmqv/4qZCxHEMUps0ZvJrY+wM34vbZYqXi649AQxHq5W dphRLa2gEZXSYG1eh1Ig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhZ3q-00E6n2-AD; Thu, 21 Apr 2022 15:49:38 +0000 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhZ3k-00E6kK-R8 for linux-mediatek@lists.infradead.org; Thu, 21 Apr 2022 15:49:36 +0000 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 23LE13oP009567; Thu, 21 Apr 2022 15:49:25 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=dIRqQt7Lt0jkB1klSblkRHBPA1X3Z01c3YYbkfbcZdw=; b=lqsqmGnNOrYU1hJfuRua1mOfv2kJbAp3XuwljTxMbb45UdveJbpe2/iF1fcjEPOP9qoO ekhwIKwCgRQQzo/UnrhBuooHiHSI0FAsHTW7WKiEgwF+8pUE9dVPV9g3bOnvq3KuGn9O Xw4//QxS5on6BCwqtu9wJQ83AmcPcqtS2sikhi/R4bYy24ixicRkF6t4VNP8Etg26gyt ckD5FuuBCaGl4eaSTZY6KnVU0Uiuafa0NCnGUyuQP0VcDoiBr4ype5edh2mg7+AbYE7j mroyVaqrtWbt644OLqyzaxKiFRHZiouvZn+zucupqNeN55ARS18s04wfBh6DeeC8tQvj Ng== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com with ESMTP id 3ffndtmf1t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Apr 2022 15:49:24 +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 23LFkjIh040746; Thu, 21 Apr 2022 15:49:17 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2168.outbound.protection.outlook.com [104.47.55.168]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3ffm88vna7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Apr 2022 15:49:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CbffCeM9YQK0o1UoBKM+CrNTq0uB2beik++CVqXEGSpOHIxp+uHdTfFNZ0YpNGISv3T02cxWD0MVgbMJe2eeZm6C555rGrdXQbHikU3DS/TrG5MawPfwxFtpFU5UYll/0q2QP7r14XXwVq2NlEucpDEg6V43SXFY7oD5zoCVg5CGGuounz9eHGsytrM3CWKArj6hzge9S1TgTl+v6GDTGd+wOZYEOSqKfQnxpNoAySBrozIhJgYkCnYO3j0LrzYUxj5lfSZcDhcBqCQI6jqcWNTn4FMAzhxSYWF3YMnFz8u10lqhI0rDEnh76GNvPOw82HH35R8yCFcNF6n1K2HipQ== 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=dIRqQt7Lt0jkB1klSblkRHBPA1X3Z01c3YYbkfbcZdw=; b=fK4bO75LGmAk6vym71Kyjg0WGOYoBZco+PLnmt3kc9f3DyjUV5109sSvpYKrV5kmLLw4FBjxAuTLCDbIJnVqJNgm/xDAzmD7ob0WePyvIBSdU+xYrp/8V8zyng1p6G7wLtwF95OnHxH68Gl0PlhmHu+u3euT2NPhCjvq+nFRttesdepspjvL24crsA6tsQAou0PuZIHcp4GK4s0ZiyDW7nKb6gxx/veFVKscM6bJY05K0mtvGmfrZltotithYGhTkxoY3arCPt00QJcW5jgZUCJHisBWoBn1YF+qRgiED1sa5DOrnQeQGbCsBX3FlTg6MJzP+wwYIRW4ed9yDWCYvw== 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=dIRqQt7Lt0jkB1klSblkRHBPA1X3Z01c3YYbkfbcZdw=; b=fK3hHvFIarSO+HlXTgUKlfA4Z4rbcUatmU0L2gfa2rIiJzRgceLKrJzDxN3Ss8U70Q3Yb1yU/zPPQRghix5DlUnzvjLyQc6XGIEItlx8d3Nkbs6dLxvT2ync57A1i/1paOaUpig1F/hsmDlHEdevABl/bljvsIliXjZlSJt4N5k= Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by CY4PR10MB1351.namprd10.prod.outlook.com (2603:10b6:903:2b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14; Thu, 21 Apr 2022 15:49:15 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::b5d5:7b39:ca2d:1b87]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::b5d5:7b39:ca2d:1b87%5]) with mapi id 15.20.5164.025; Thu, 21 Apr 2022 15:49:15 +0000 Date: Thu, 21 Apr 2022 18:49:02 +0300 From: Dan Carpenter To: Felix Fietkau Cc: John Crispin , Sean Wang , Mark Lee , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Matthias Brugger , netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, kernel-janitors@vger.kernel.org Subject: [PATCH net-next] net: ethernet: mtk_eth_soc: add check for allocation failure Message-ID: Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-ClientProxiedBy: ZR0P278CA0002.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:16::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: 32e58fdf-68e8-4864-66ee-08da23ae7d09 X-MS-TrafficTypeDiagnostic: CY4PR10MB1351:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OXFp1flKK+gKnFQ5XrxFYadGUs7mn9qqjeUEkrfbY1VsEygNB999K4sVoYQgtFninzQCv90RAyhDM9r3O2xWT6lABwsC5su0zGFPvFDrKLLcLBfxSLWYVNiZ9FUb94AE1dnkryw87L0746Ek2foHMKeB4jJ3rScDtaNEp1ix78QLkfthwSLZvrHN2P4IPr+2+qEz7J4XB1pOXoqleBDz/vekibZ9Ea3UiClCUtzTZTWFQtrhjP98BEkDJnf8O/nHXh3f3jFX6abol1ObrMyUD+Jz4Bu6f7eEbi5XZHD9BBGzhn2RTMpMo4JO+fMmrnq/CEo0xxKmyILpppmSgBIQbnU+yyH1/jDQ8s7SOU49/iKAz90ZI2XMhnR+UcNicIyBn+uLemj3lva+4f/7sNlAJE+mqPGRO9tHFVazCYyE3tISaft7QARPutdRxxsJsQn4Ny/eMlozJ46GFNsyoIftw0T++UTBjFHmc22UgS9zetGsFO+1Rm/ZCGiMmUcm28yKW/iR6rbI3xX8z7vhJfCunTlxVObUgbD8gPaCrizxcpNJBeEmW215cS0VqN1i4CN2cZbJDg4Ru5+NW6hrXNBIXe7NxqamAqxyvwjihBwAiJGwIczTKymhGUhW2ra8ep68N1X01a6MfFOMjgjfBxToakuARZ9gT4ytZ00Ci4PwNeSLFvudKIAwR2RZdD1OnnoUeclkxatg8r5fvdmt1NcP0Q== 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:(13230001)(7916004)(366004)(6506007)(6512007)(9686003)(26005)(38100700002)(52116002)(6486002)(7416002)(4744005)(38350700002)(8936002)(5660300002)(6666004)(2906002)(83380400001)(33716001)(86362001)(44832011)(508600001)(186003)(316002)(54906003)(66946007)(66476007)(6916009)(66556008)(4326008)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: e9Rpw7GmdJ0lRP0e/D+KBsiOX4sqt6CjKuVXYheP+2I55Q1CL45AJBvjQNtqWHU5WBFmAFqrTH+z2BfZcT81i00rv0lQaD6aPvlraiKDyJyc5iXevagGChRhZLO21yuEo8JN16Q6RE32P0rUEMZrE7a4Dp48FrVIoq+LIZm5R2ByrhCi/WfG3YT3Ees9Zi++NsTexc7L+vlYmmkDJeAn/8p7k+3AP70KZtyOqAGG8v00w54Z9JDd1e1x63dUSminbQ5ncIF9+9Cc2xviTaDGYc3jKoaRMBg4d56DZ4amZ5fQHSYDrcbKvRZDplG4xeNH0pZMAg8P+r1m5bgt6uwQhlnbZmSGL+W9Wm6wCbLoyfPFHCCd9HO5txaQ9OTRg8v+uQhKuMZ3ftKdbmoWefTJaCmoIDLek/+Z/I2pt+aUId7Jm2O3NQvc/QBkqa2MWY/wH5hITF1/6Ae7ITTlYg+wIbu7yAvL88/Frxy2ilhqwjGFTUf2ENUH1rftKEyN0t8wHx/b3PGFJAk3gxBP07kVYzVRsHUuHNCamvyOz8KCGND5czcSE275H6p+ws+8svEJJjgPQO4VSi/Qj2RwrNBJpE40F1V9AI+h4FSkpkKf61fCkDb2mCMqKg7W1UhXWgR31g7ALC48Pa9p40p1dspg0mCYaCs/FKTmlDZNLDsQTQ9psM9TzhGiE0QG/9lAO1tBD4c1jxN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-Exchange-CrossTenant-Network-Message-Id: 32e58fdf-68e8-4864-66ee-08da23ae7d09 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2022 15:49:15.7583 (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: TAtJQ4Piw4L1bOCvE0hXbFfN4nTYX39/EQw2kwIZVHxgZwAAked6rP4c+SGGqdReWbEh7Gvd5KgifRYdK3GUk5tkRwG3viYOEUehdl++8+k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR10MB1351 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.858 definitions=2022-04-21_02:2022-04-21, 2022-04-21 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 phishscore=0 adultscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204210085 X-Proofpoint-ORIG-GUID: HO3IZxmQuTPpfubunHitvtbyF6-vgasf X-Proofpoint-GUID: HO3IZxmQuTPpfubunHitvtbyF6-vgasf X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220421_084933_084842_CE90A852 X-CRM114-Status: GOOD ( 13.17 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Check if the kzalloc() failed. Fixes: 804775dfc288 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)") Signed-off-by: Dan Carpenter --- drivers/net/ethernet/mediatek/mtk_wed.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c index f0eacf819cd9..a2793bbb8ce0 100644 --- a/drivers/net/ethernet/mediatek/mtk_wed.c +++ b/drivers/net/ethernet/mediatek/mtk_wed.c @@ -827,6 +827,8 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth, goto unlock; hw = kzalloc(sizeof(*hw), GFP_KERNEL); + if (!hw) + goto unlock; hw->node = np; hw->regs = regs; hw->eth = eth;