Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp499503pxu; Thu, 3 Dec 2020 05:53:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyzm+/aChiKC6086PiF5wfkdwmWKgoGA2TbJPkyzJS3wcOpWjLFMCq04sd1tkJmIz2d6k5S X-Received: by 2002:a17:906:c51:: with SMTP id t17mr2652863ejf.523.1607003611183; Thu, 03 Dec 2020 05:53:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607003611; cv=none; d=google.com; s=arc-20160816; b=ErO942mAOBgPmHv6Knh5wSnta1GKW62EmBuvrp5jhgnyGYDgVGdWVy2uk0Ys3oAUaq Yqc8dnnEjbbnViXPtUjiu7a8hIzwfq9HqXycCyYleTlYnTdM8mKWeC2EmMc6Vzz8jnsc 8/3xAQMzhjZVHfZl1qTcMGDPKf7za7Gh2Yyaw4LEcxlFNp6zBL3oEOq0tWVJxBN+fNxL swKMBBIewdDJQcBeyD2pxtrFibjnnRu6Agy11elD26qudAm2R1fAAALh+eqNMOXtMGHp 6hLNd8YkKHQ9f7AHZwgxttkt4PyxjhxRFCJChJco25raVoXYFT0/k4HcZOvHgAlhJb+S SmKw== 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:dkim-signature; bh=plP/bTLAduxXDkk4ZNIIU74yKiIZjrQEty9nrRdjKWU=; b=J1UvAavwMXnqaEFvSSvrP+Ey/0EpoiTOnbAbxxQfGc5p2v7up8ZkkZsu7Ap18rH2HA PYJXArrufKo0qK9lPIJzPFSVYQpkp/+huzNX7PdWtn6WuevQiiq9G18qG2WkbZur93AD eTF2Rmm5rCbl/KnSqslxkEvXnneUwP5M+oaJC/eluv2DNLDupa0rJL3xlg916589LL0Y e6S045ViHuHDCqaX9Gp8BqnfFI+M3l2jXOE0OPedMPs8UwN4TSwRLAu/TFvr0teOFv7H gqQcrDUAmC6NfRrMNWclk38nQ+DrAqkeDSm6z0tianBJ7YDnLoraPyD79Qyhi0if7och 0uNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@essensium.com header.s=google header.b=Cn80YsmT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=essensium.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p90si934941edd.341.2020.12.03.05.53.05; Thu, 03 Dec 2020 05:53:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@essensium.com header.s=google header.b=Cn80YsmT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=essensium.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730292AbgLCNve (ORCPT + 99 others); Thu, 3 Dec 2020 08:51:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727555AbgLCNvd (ORCPT ); Thu, 3 Dec 2020 08:51:33 -0500 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73FE6C061A51 for ; Thu, 3 Dec 2020 05:50:53 -0800 (PST) Received: by mail-ed1-x541.google.com with SMTP id r5so2115417eda.12 for ; Thu, 03 Dec 2020 05:50:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=essensium.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=plP/bTLAduxXDkk4ZNIIU74yKiIZjrQEty9nrRdjKWU=; b=Cn80YsmTfKXqKV5nw/bJ93ttZUqwPSzgJ+mA18itw5EqvqyggNTFuTiyYJ/PUzW47Q Zg13S05NIisOUOgglu0Dx24cHNK9MOdo0zo8S1iloUICcklCNcZhTfO6pfsNI49B0Uxk DQoE//xMS0d6Ro4TnRTBkXer+FMByanXWJqeuUavsoFunzz5Ls8/4gr2+aYA8ikxsLW6 EDLiH/Mu4mqUGRJKfKgXOPxgc9GyJXkhbpkh77HejswuDgAQ8UoU1zO892qMIaE5MVdW TYBkw6H2E7fkJFjRaZ0xZZCq6Nz8K2CquaaGAPmW2p2eKTHMWst5FlI1CSXFFwa+sw8F NROQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=plP/bTLAduxXDkk4ZNIIU74yKiIZjrQEty9nrRdjKWU=; b=nezf0652Qfe6nA8J+TxAV7PQmoPBTe9954HFQNL9bDzDThE25cCsr5l7hbW8E7ZMZN RA6GGLffg9XxrIsKa0nE9h3kTyOdObIrC32VuKNXf/cMnSTaBMACSAi2socCUynBOUHu EO4nxLNzHfJ6HntCAOIkd4+akaHoTPUsQdq7M6rMX6w7t+cInuvq9br3kjStk96FTwfy +ValgK0wDHa2pq44qTnsfw6tfV0Iz+A3u+imEiQ1ggr/XY2hYRgWvOZjhEPWtpN47T4j O6n/aQRy5WfM4O8CGHpf2PJQ22LoPq8ASOm4Gs8qDLkx098otINzrLbRgleIsW/EgI17 y/pQ== X-Gm-Message-State: AOAM533enR292aiatMyONS+ZWrZ8XeXcFedDOIBlK9W+PBwPQ2jJe5+S AgKTLM6T012acYJtRiDvghXkpBStt6IM3g== X-Received: by 2002:a50:ab47:: with SMTP id t7mr2943580edc.289.1607003452090; Thu, 03 Dec 2020 05:50:52 -0800 (PST) Received: from belels006.local.ess-mail.com (ip-188-118-3-185.reverse.destiny.be. [188.118.3.185]) by smtp.gmail.com with ESMTPSA id t19sm903192eje.86.2020.12.03.05.50.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 05:50:51 -0800 (PST) From: Patrick Havelange To: Madalin Bucur , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Patrick Havelange Subject: [PATCH net 0/4] freescale/fman: remove usage of __devm_request_region Date: Thu, 3 Dec 2020 14:50:35 +0100 Message-Id: <20201203135039.31474-1-patrick.havelange@essensium.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, This patch series is solving a bug inside ethernet/freescale/fman/fman_port.c caused by an incorrect usage of __devm_request_region. The bug came from the fact that the resource given as parameter to the function __devm_request_region is on the stack, leading to an invalid pointer being stored inside the devres structure, and the new resource pointer being lost. In order to solve this, it is first necessary to make the regular call devm_request_mem_region work. This call cannot work as is, because the main fman driver has already reserved the memory region used by the fman_port driver. Thus the first action is to split the memory region reservation done in the main fman driver in two, so that the regions used by fman_port will not be reserved. The main memory regions have also been reduced to not request the memory regions used by fman_mac. Once this first step is done, regular usage of devm_request_mem_region can be done. This also leads to a bit of code removal done in the last patch. 1. fman: split the memory region of the main fman driver, so the memory that will be used by fman_port & fman_mac will not be already reserved. 2. fman_port: replace call of __devm_request_region to devm_request_mem_region 3. fman_mac: replace call of __devm_request_region to devm_request_mem_region 4. the code is now simplified a bit, there is no need to store the main region anymore The whole point of this series is to be able to apply the patch N°2. Since N°3 is a similar change, let's do it at the same time. I think they all should be part of the same series. Patrick Havelange (4): net: freescale/fman: Split the main resource region reservation net: freescale/fman-port: remove direct use of __devm_request_region net: freescale/fman-mac: remove direct use of __devm_request_region net: freescale/fman: remove fman_get_mem_region drivers/net/ethernet/freescale/fman/fman.c | 120 +++++++++--------- drivers/net/ethernet/freescale/fman/fman.h | 11 +- .../net/ethernet/freescale/fman/fman_port.c | 6 +- drivers/net/ethernet/freescale/fman/mac.c | 8 +- 4 files changed, 75 insertions(+), 70 deletions(-) base-commit: 832e09798c261cf58de3a68cfcc6556408c16a5a -- 2.17.1