Skip to content
  • Prarit Bhargava's avatar
    hwrng: amd - Revert managed API changes · 69db7009
    Prarit Bhargava authored
    After commit 31b2a73c ("hwrng: amd - Migrate to managed API"), the
    amd-rng driver uses devres with pci_dev->dev to keep track of resources,
    but does not actually register a PCI driver.  This results in the
    following issues:
    
    1. The message
    
    WARNING: CPU: 2 PID: 621 at drivers/base/dd.c:349 driver_probe_device+0x38c
    
    is output when the i2c_amd756 driver loads and attempts to register a PCI
    driver.  The PCI & device subsystems assume that no resources have been
    registered for the device, and the WARN_ON() triggers since amd-rng has
    already do so.
    
    2.  The driver leaks memory because the driver does not attach to a
    device.  The driver only uses the PCI device as a reference.   devm_*()
    functions will release resources on driver detach, which the amd-rng
    driver will never do.  As a result,
    
    3.  The driver cannot be reloaded because there is always a use of the
    ioport and region after the first load of the driver.
    
    Revert the changes made by 31b2a73c
    
     ("hwrng: amd - Migrate to managed
    API").
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: default avatarPrarit Bhargava <prarit@redhat.com>
    Fixes: 31b2a73c
    
     ("hwrng: amd - Migrate to managed API").
    Cc: Matt Mackall <mpm@selenic.com>
    Cc: Corentin LABBE <clabbe.montjoie@gmail.com>
    Cc: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
    Cc: Wei Yongjun <weiyongjun1@huawei.com>
    Cc: linux-crypto@vger.kernel.org
    Cc: linux-geode@lists.infradead.org
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    69db7009