Skip to content

Commit d56fbfb

Browse files
Chen Nijwrdegoede
authored andcommitted
platform/mellanox: nvsw-sn2201: Add check for platform_device_add_resources
Add check for the return value of platform_device_add_resources() and return the error if it fails in order to catch the error. Signed-off-by: Chen Ni <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent 77f1972 commit d56fbfb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/platform/mellanox/nvsw-sn2201.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,15 +1198,18 @@ static int nvsw_sn2201_config_pre_init(struct nvsw_sn2201 *nvsw_sn2201)
11981198
static int nvsw_sn2201_probe(struct platform_device *pdev)
11991199
{
12001200
struct nvsw_sn2201 *nvsw_sn2201;
1201+
int ret;
12011202

12021203
nvsw_sn2201 = devm_kzalloc(&pdev->dev, sizeof(*nvsw_sn2201), GFP_KERNEL);
12031204
if (!nvsw_sn2201)
12041205
return -ENOMEM;
12051206

12061207
nvsw_sn2201->dev = &pdev->dev;
12071208
platform_set_drvdata(pdev, nvsw_sn2201);
1208-
platform_device_add_resources(pdev, nvsw_sn2201_lpc_io_resources,
1209+
ret = platform_device_add_resources(pdev, nvsw_sn2201_lpc_io_resources,
12091210
ARRAY_SIZE(nvsw_sn2201_lpc_io_resources));
1211+
if (ret)
1212+
return ret;
12101213

12111214
nvsw_sn2201->main_mux_deferred_nr = NVSW_SN2201_MAIN_MUX_DEFER_NR;
12121215
nvsw_sn2201->main_mux_devs = nvsw_sn2201_main_mux_brdinfo;

0 commit comments

Comments
 (0)