From patchwork Wed Mar 23 08:47:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Sondhau=C3=9F=2C_Jan?= X-Patchwork-Id: 553972 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 A1898C433F5 for ; Wed, 23 Mar 2022 08:47:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236495AbiCWItN (ORCPT ); Wed, 23 Mar 2022 04:49:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234839AbiCWItM (ORCPT ); Wed, 23 Mar 2022 04:49:12 -0400 Received: from mx08-005c9601.pphosted.com (mx08-005c9601.pphosted.com [205.220.185.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E830C6E8C1 for ; Wed, 23 Mar 2022 01:47:42 -0700 (PDT) Received: from pps.filterd (m0237838.ppops.net [127.0.0.1]) by mx08-005c9601.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 22N4peb7031112; Wed, 23 Mar 2022 09:47:39 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wago.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=p012021; bh=dtAROhqHJPyLadgPSspTvlWH1MbF+LAeF3wSo6civ9w=; b=kgJzPQscLDz6Rj+BJInX5vWKjnR7Bgk0om5s6JAQzBRoD8ydwcINIdZ2qx6ftN44vm8L qkNgmfKyLD6d9rGGjiCPamhHrhOv/boXDXodnmWiP3laVEQmYQQ0TVHn5vHtO+UFqmLR BftRFU2WbCLotgbTEXCLgj7QFpSLu0TMUUHl4JXKzq52QhMiCiBQnSk/3cuXlgNOkHMv tfcTyGeGX+hGWBv4OOCa5F8gFFqcpw5oug6CkH4DkDox05O62mmXhQmm5MGE2/VUpfTF QYpkGRhjT6cB0ZNRt6Y4uEP1gY7GFkixKzYiCkUVgIavqHtuCwsoxZT5HZ9xmaKmsLQ/ mA== Received: from mail.wago.com ([217.237.185.168]) by mx08-005c9601.pphosted.com (PPS) with ESMTPS id 3ey7t09thv-9 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 23 Mar 2022 09:47:38 +0100 Received: from SVEX01009.wago.local (10.1.103.227) by SVEX01014.wago.local (10.1.103.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 23 Mar 2022 09:47:34 +0100 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (10.1.103.197) by outlook.wago.com (10.1.103.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21 via Frontend Transport; Wed, 23 Mar 2022 09:47:34 +0100 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LlX7tzRncmN0Ov0N+AgmZ4XmD9A3OVWzp8B6ETkqE0VR11wRLcQtWyEmt6clufFjVFNXtH1lPAJxQ1cpOesEWU0PpCTg05yXX3IFZrA3L4jnYRV3DrRRdNGtfHJlvFyfvSsbcT81lx0s49WnwubDStmRw/XBO3uhYEdjnRh1hVWh7taMYWf/DurLxSf8rNNVzdXZvRlMs1fCycLpvtlqPeOeiHl2S/FlbVJeNK7v+/vXsP3VYMaavCdO+XGSV/gIaZmJip+vASB4F077kh+fBajArh21+p+Ex7M+lrQleG+Z2MZc84GHb9qGfcQh/CMXBiiqGHbRJ/rGyMSzEYg5pQ== 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=dtAROhqHJPyLadgPSspTvlWH1MbF+LAeF3wSo6civ9w=; b=ILoKd4DfA21JbsziAh2rPXwWBX22EvoNzL0XjzK3EH0a4IK84fhOyjRW6BtoYZdUdTD2dR0p0QVLuQcqtq65ikCYN4rTSjMr3JlF/eOcNGWFQOYz5i04Q9YHldc9Ym4oVl+R+x+QK6Ebl0xKn58sojbRQWDxRTQJnMlTYIxGRjyZt8oesLI3aL6NmESzS7vfQuQyRBHtH26DE53+HaTW/Lheq1DmBlwABZry/mn9CSkm9yFKjwtw0WTIJuo6h4V6JbqG6Gglf4t/7v6q4Y+RFzwk+kVecLKtjcJ0WLzRnYM0yf3ovUT/+vBI2aLZz21+uOHjF7VkOmydWCmXWIivmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wago.com; dmarc=pass action=none header.from=wago.com; dkim=pass header.d=wago.com; arc=none Received: from DB8PR08MB5097.eurprd08.prod.outlook.com (2603:10a6:10:38::15) by AM0PR08MB3236.eurprd08.prod.outlook.com (2603:10a6:208:59::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.18; Wed, 23 Mar 2022 08:47:33 +0000 Received: from DB8PR08MB5097.eurprd08.prod.outlook.com ([fe80::cc57:a7c3:cf03:e4cb]) by DB8PR08MB5097.eurprd08.prod.outlook.com ([fe80::cc57:a7c3:cf03:e4cb%6]) with mapi id 15.20.5081.023; Wed, 23 Mar 2022 08:47:33 +0000 From: =?iso-8859-1?q?Sondhau=DF=2C_Jan?= To: "grygorii.strashko@ti.com" , "vigneshr@ti.com" CC: "netdev@vger.kernel.org" , "linux-omap@vger.kernel.org" , =?iso-8859-1?q?S?= =?iso-8859-1?q?ondhau=DF=2C_Jan?= Subject: [PATCH v2] drivers: ethernet: cpsw: fix panic when intrrupt coaleceing is set via ethtool Thread-Topic: [PATCH v2] drivers: ethernet: cpsw: fix panic when intrrupt coaleceing is set via ethtool Thread-Index: AQHYPpKjIr8iUrchREGeM/mphxhjsA== Date: Wed, 23 Mar 2022 08:47:33 +0000 Message-ID: <20220323084725.65864-1-jan.sondhauss@wago.com> Accept-Language: en-DE, en-US, de-DE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.35.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d612c19e-bd88-4fc2-e16e-08da0ca9c5c5 x-ms-traffictypediagnostic: AM0PR08MB3236: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: AaliTK2+ffv41o7Oxu6AGiEI/LsB8hvmn3V0P1PLm5nRKnqRZio19BlB0mE/pN9Zig3i/hduQXXh7x0t4PaiXS4ZolMpu1G4hG2NCktyiCgix2CCE3+0xaJ1fBaSC0c08XxBMkDLFbU1ZIsAdUWzgBMDH17xoPOuPWwGjh6eguDtqd/R10Vi3x/4AlLxbkN0e8NjrGjkxLAkp9+XKZSSoaLPnma8ghx3FIIFs5EbHexvtSmZAjK3+vgrSW9yYJ+b5UmKc8J6/0MYrD2HdktdevOJpDzMAv0DMF7Y4rXMmsnKMtaKUHkG0uhKyj2TK4wp/R3q8NibxWbTY1hd5nOeUxncI/urFf0+pWE1893pv36hyZLALPw9OZ2TiweaAomba3YjhWR2AzlIDCD3vgEeWYnLUQCHT8pQ7amhV39W80Cf86gyhb17AYrcuLAJumc/a/gSvEsahpduJr2HwMEd/48qrlTLQxgfK+WC3uADP6dkwYDa7z1uPc7p3AEVm/pZNCC3PsSFyEiAuGzkaXk3/jz5xkI3vHdxLvzjOBtyZzy2RVhXflGBhOFr57zNm+SnPVlID5V024M8EdeBrTEoY5SqWLjv3/EKYs50RcJEjfqVYsUgnAEofWr5Zb1xmDbbqyGjg47fDzOHTwq+jui73Ix6rqzGahSCaLGGZO1AOhe4juHgGXrV+pRSJ5FXffnIccHGMq5bT8Zaak3aSgQ4Rg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR08MB5097.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6512007)(38100700002)(38070700005)(86362001)(122000001)(2906002)(71200400001)(26005)(186003)(316002)(6506007)(36756003)(54906003)(110136005)(508600001)(6486002)(66946007)(4326008)(66556008)(66446008)(5660300002)(8676002)(76116006)(8936002)(64756008)(66476007)(107886003)(2616005)(1076003)(83380400001)(91956017); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?RhsJlkHaiDVe0VZr1Obd0wh?= =?iso-8859-1?q?vjAu19oBYmRm3bH7YUDeohZBxWDjGbdu4qAosinu3F6ub1ENdj5Zu05thkal?= =?iso-8859-1?q?xbm/5XegklLavRK2L6DdMzp5ntYHF7dee0XH6R4mtudu5Nrpeq+zGC4WAlrp?= =?iso-8859-1?q?Sq4YnG8V7+GXXwlZkYI0IVTGfximfdCzdyRR1IcMtoiQwB9y5otZhdOKHc3q?= =?iso-8859-1?q?O9mpjZZZfcRHuVWXVJSksZMrX+2HbY+6va2gNIebjTUD1edDIpqU8YFqHTL+?= =?iso-8859-1?q?T4giAkfrS10jAsr2Iq78JV3u58kpM+OHhJLW8TJjG1mlG7K8nkxNw51nlXCf?= =?iso-8859-1?q?8oSR+J9bI1naXvXTkJ5vDsPuQS7xQBJtsVy+PPNu9XGiEGxNC+WW86D2c96f?= =?iso-8859-1?q?oZ8HbkegNoWRpcemWDwMak1fiLThw5WJ947h87Q2OltNso1FNdZQ5/PAGgXg?= =?iso-8859-1?q?/ny/ESX4KTuVZfRCCuKC2T/u0tE1R3BKfjefIosnLZcwiUW2x+2mWspMxjiG?= =?iso-8859-1?q?cZAJtd5P33udQ13E+6proV3f8N9KG1cRejcik48zgLyuWxgOtE2NqW6N/wU2?= =?iso-8859-1?q?3iJQoxrSCKA5ebOFCKSr5toLT6UIx0izPTIvpOhTlYJyjavNPuO+Qh+wwDTQ?= =?iso-8859-1?q?9jUqRx/t0S+CXtMjFqXhnudqEtTYZtIu9Jj7Xn0KWrsE2UjMRLV8bbCI9z7Y?= =?iso-8859-1?q?rSiO+2wuJBd2AJNGhDD7wrw3qwr4iQ3Qd5v68UoQTeNtdElvv/Rb37jmhfx8?= =?iso-8859-1?q?IqHcDwIqW2SrblxStQPqs2a0ZgnMJG96Hfcg0z22OZIogJRuZTmK/cYn5do/?= =?iso-8859-1?q?ynGq7ckvkRb+rtrpbjsUOOc/iYlzwE80d1DHu3bYnDN1GKm+QPfLPCYWjdtT?= =?iso-8859-1?q?9h8j9uQB2Zk0ceGBjthLgEaw2LB5XI0tyFv8VGDIo946JQ67mlLHheaFczPW?= =?iso-8859-1?q?9PRnKy6JQiz90TGft7on1xitcT83+tgEycZiFssOszJOBz7KWOEyC5ebF5XE?= =?iso-8859-1?q?FLFohw73+R2b69EICMA6G4/6y8QZy9mkz/uHEZF5CkWlOrza/avd5vqC2vCP?= =?iso-8859-1?q?pJeIm9XbSTRAVIczxOGNyGyIQY21JoTeuHIXER6+6SeyuKhdW411rjzsW+sv?= =?iso-8859-1?q?DkKibvqZeZdr/RVIsfWiy2gkbWOrsKRgnB1OXPIaRh1br9g9EhWr1VqNak5q?= =?iso-8859-1?q?ahItZHMADL5MMS6wAQhQnQv7+GOF2BxP0/yeNCazIWSayXfp4TnItJDforAP?= =?iso-8859-1?q?12rNVDln6UGieOpQpc5vweIGV5/flcwQ7mysF18u2g5SIbpgB031bsm3yHT+?= =?iso-8859-1?q?X95vDLOhIxGkUGPO0KNnpv0ZpZJivyVBuTRDtWgJo+qL9hbGCSeKS+maiB4z?= =?iso-8859-1?q?kBQAJ+jz4a6KJi+vrgJ4eQDLy91YyXFuYtK+6SEUYg2n6MULgABmJpPxTB7h?= =?iso-8859-1?q?XixIgTjDCOwYmKaa6uWQV85VLvFu5z+sYrLSzO10xz/qq/c5lITX87xm4CP/?= =?iso-8859-1?q?1OaX1dm+BPdDeMdWylkPdiGtdrMxmVg=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DB8PR08MB5097.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d612c19e-bd88-4fc2-e16e-08da0ca9c5c5 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Mar 2022 08:47:33.2651 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: e211c965-dd84-4c9f-bc3f-4215552a0857 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: TZiXxL9OZf5uftJ5H4c+1ZKmT3uF6gGS37xVBOfknPhnBZ7pSydMdu3MJHP6AsRo4fHROneegmT845f6fLCj7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3236 X-OriginatorOrg: wago.com X-KSE-ServerInfo: SVEX01014.wago.local, 9 X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 23.03.2022 06:00:00 X-KSE-BulkMessagesFiltering-Scan-Result: protection disabled X-Proofpoint-GUID: CqETP8jOQ969yEod1g2mlyq62-pwhN0y X-Proofpoint-ORIG-GUID: CqETP8jOQ969yEod1g2mlyq62-pwhN0y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-23_04,2022-03-22_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 phishscore=0 adultscore=0 mlxlogscore=809 impostorscore=0 malwarescore=0 spamscore=0 clxscore=1015 bulkscore=0 lowpriorityscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203230051 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org cpsw_ethtool_begin directly returns the result of pm_runtime_get_sync when successful. pm_runtime_get_sync returns -error code on failure and 0 on successful resume but also 1 when the device is already active. So the common case for cpsw_ethtool_begin is to return 1. That leads to inconsistent calls to pm_runtime_put in the call-chain so that pm_runtime_put is called one too many times and as result leaving the cpsw dev behind suspended. The suspended cpsw dev leads to an access violation later on by different parts of the cpsw driver. Fix this by calling the return-friendly pm_runtime_resume_and_get function. Signed-off-by: Jan Sondhauss Reviewed-by: Vignesh Raghavendra --- drivers/net/ethernet/ti/cpsw_ethtool.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw_ethtool.c b/drivers/net/ethernet/ti/cpsw_ethtool.c index 158c8d3793f4..b5bae6324970 100644 --- a/drivers/net/ethernet/ti/cpsw_ethtool.c +++ b/drivers/net/ethernet/ti/cpsw_ethtool.c @@ -364,11 +364,9 @@ int cpsw_ethtool_op_begin(struct net_device *ndev) struct cpsw_common *cpsw = priv->cpsw; int ret; - ret = pm_runtime_get_sync(cpsw->dev); - if (ret < 0) { + ret = pm_runtime_resume_and_get(cpsw->dev); + if (ret < 0) cpsw_err(priv, drv, "ethtool begin failed %d\n", ret); - pm_runtime_put_noidle(cpsw->dev); - } return ret; }