net: dm9051: Use PTR_ERR_OR_ZERO() to simplify code
authorRuan Jinjie <ruanjinjie@huawei.com>
Thu, 17 Aug 2023 02:24:18 +0000 (10:24 +0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 18 Aug 2023 22:32:52 +0000 (15:32 -0700)
Return PTR_ERR_OR_ZERO() instead of return 0 or PTR_ERR() to
simplify code.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20230817022418.3588831-1-ruanjinjie@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/davicom/dm9051.c

index 70728b2..2caaf1e 100644 (file)
@@ -510,10 +510,7 @@ static int dm9051_map_init(struct spi_device *spi, struct board_info *db)
 
        regconfigdmbulk.lock_arg = db;
        db->regmap_dmbulk = devm_regmap_init_spi(db->spidev, &regconfigdmbulk);
-       if (IS_ERR(db->regmap_dmbulk))
-               return PTR_ERR(db->regmap_dmbulk);
-
-       return 0;
+       return PTR_ERR_OR_ZERO(db->regmap_dmbulk);
 }
 
 static int dm9051_map_chipid(struct board_info *db)