Skip to content

Commit

Permalink
misc: alcor_pci: fix inverted branch condition
Browse files Browse the repository at this point in the history
commit 281e468 upstream.

This patch fixes a trivial mistake that I made in the previous attempt
in fixing the null bridge issue. The branch condition is inverted and we
should call alcor_pci_find_cap_offset() only if bridge is not null.

Reported-by: Colin Ian King <colin.king@canonical.com>
Fixes: 3ce3e45 ("misc: alcor_pci: fix null-ptr-deref when there is no PCI bridge")
Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Link: https://lore.kernel.org/r/20210522043725.602179-1-ztong0001@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
lzto authored and gregkh committed Jul 20, 2021
1 parent 9930eeb commit 31cf8e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/misc/cardreader/alcor_pci.c
Expand Up @@ -144,7 +144,7 @@ static void alcor_pci_init_check_aspm(struct alcor_pci_priv *priv)
* priv->parent_pdev will be NULL. In this case we don't check its
* capability and disable ASPM completely.
*/
if (!priv->parent_pdev)
if (priv->parent_pdev)
priv->parent_cap_off = alcor_pci_find_cap_offset(priv,
priv->parent_pdev);

Expand Down

0 comments on commit 31cf8e7

Please sign in to comment.