[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201203135039.31474-1-patrick.havelange@essensium.com>
Date: Thu, 3 Dec 2020 14:50:35 +0100
From: Patrick Havelange <patrick.havelange@...ensium.com>
To: Madalin Bucur <madalin.bucur@....com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Patrick Havelange <patrick.havelange@...ensium.com>
Subject: [PATCH net 0/4] freescale/fman: remove usage of __devm_request_region
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
Powered by blists - more mailing lists