From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B97BC433C1 for ; Thu, 3 Dec 2020 13:51:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B1413206D8 for ; Thu, 3 Dec 2020 13:51:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726366AbgLCNve (ORCPT ); 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-Google-Smtp-Source: ABdhPJxBSSFRQjdp7yxP1yhW8LJSG88giWm0idIOkTcotdfCQzXmqsbzD6VGV3YP0fmv0c+sK1qsNw== 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