@@ -524,7 +524,8 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client,
524
524
phy -> gpiod_ena = devm_gpiod_get (dev , "enable" , GPIOD_OUT_LOW );
525
525
if (IS_ERR (phy -> gpiod_ena )) {
526
526
nfc_err (dev , "Unable to get ENABLE GPIO\n" );
527
- return PTR_ERR (phy -> gpiod_ena );
527
+ r = PTR_ERR (phy -> gpiod_ena );
528
+ goto out_free ;
528
529
}
529
530
530
531
phy -> se_status .is_ese_present =
@@ -535,7 +536,7 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client,
535
536
r = st21nfca_hci_platform_init (phy );
536
537
if (r < 0 ) {
537
538
nfc_err (& client -> dev , "Unable to reboot st21nfca\n" );
538
- return r ;
539
+ goto out_free ;
539
540
}
540
541
541
542
r = devm_request_threaded_irq (& client -> dev , client -> irq , NULL ,
@@ -544,15 +545,23 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client,
544
545
ST21NFCA_HCI_DRIVER_NAME , phy );
545
546
if (r < 0 ) {
546
547
nfc_err (& client -> dev , "Unable to register IRQ handler\n" );
547
- return r ;
548
+ goto out_free ;
548
549
}
549
550
550
- return st21nfca_hci_probe (phy , & i2c_phy_ops , LLC_SHDLC_NAME ,
551
- ST21NFCA_FRAME_HEADROOM ,
552
- ST21NFCA_FRAME_TAILROOM ,
553
- ST21NFCA_HCI_LLC_MAX_PAYLOAD ,
554
- & phy -> hdev ,
555
- & phy -> se_status );
551
+ r = st21nfca_hci_probe (phy , & i2c_phy_ops , LLC_SHDLC_NAME ,
552
+ ST21NFCA_FRAME_HEADROOM ,
553
+ ST21NFCA_FRAME_TAILROOM ,
554
+ ST21NFCA_HCI_LLC_MAX_PAYLOAD ,
555
+ & phy -> hdev ,
556
+ & phy -> se_status );
557
+ if (r )
558
+ goto out_free ;
559
+
560
+ return 0 ;
561
+
562
+ out_free :
563
+ kfree_skb (phy -> pending_skb );
564
+ return r ;
556
565
}
557
566
558
567
static int st21nfca_hci_i2c_remove (struct i2c_client * client )
@@ -563,6 +572,8 @@ static int st21nfca_hci_i2c_remove(struct i2c_client *client)
563
572
564
573
if (phy -> powered )
565
574
st21nfca_hci_i2c_disable (phy );
575
+ if (phy -> pending_skb )
576
+ kfree_skb (phy -> pending_skb );
566
577
567
578
return 0 ;
568
579
}
0 commit comments