[PATCH] ASoC: fsl: Check before clk_put() not needed
clk_put() already checks the clk ptr using !clk and IS_ERR() so there is no need to check it again before calling it. Signed-off-by: Yihao Han --- sound/soc/fsl/imx-sgtl5000.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c index 580a0d963f0e..16a281820186 100644 --- a/sound/soc/fsl/imx-sgtl5000.c +++ b/sound/soc/fsl/imx-sgtl5000.c @@ -185,8 +185,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) put_device: put_device(_dev->dev); fail: - if (data && !IS_ERR(data->codec_clk)) - clk_put(data->codec_clk); + clk_put(data->codec_clk); of_node_put(ssi_np); of_node_put(codec_np); -- 2.17.1
[PATCH v2] macintosh: macio_asic: fix resource_size.cocci warnings
drivers/macintosh/macio_asic.c:219:26-29: WARNING:Suspicious code. resource_size is maybe missing with res drivers/macintosh/macio_asic.c:221:26-29: WARNING:Suspicious code. resource_size is maybe missing with res Use resource_size function on resource object instead of explicit computation. Generated by: scripts/coccinelle/api/resource_size.cocci Signed-off-by: Yihao Han --- v2: drop parenthesis around resource_size(res) and edit commit message --- drivers/macintosh/macio_asic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index 1943a007e2d5..260fccb3863e 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c @@ -216,9 +216,9 @@ static int macio_resource_quirks(struct device_node *np, struct resource *res, /* Some older IDE resources have bogus sizes */ if (of_node_name_eq(np, "IDE") || of_node_name_eq(np, "ATA") || of_node_is_type(np, "ide") || of_node_is_type(np, "ata")) { - if (index == 0 && (res->end - res->start) > 0xfff) + if (index == 0 && resource_size(res) > 0xfff) res->end = res->start + 0xfff; - if (index == 1 && (res->end - res->start) > 0xff) + if (index == 1 && resource_size(res) > 0xff) res->end = res->start + 0xff; } return 0; -- 2.17.1
[PATCH] macintosh: macio_asic: fix resource_size.cocci warnings
drivers/macintosh/macio_asic.c:219:26-29: WARNING: Suspicious code. resource_size is maybe missing with res drivers/macintosh/macio_asic.c:221:26-29: WARNING: Suspicious code. resource_size is maybe missing with res Use resource_size function on resource object instead of explicit computation. Generated by: scripts/coccinelle/api/resource_size.cocci Signed-off-by: Yihao Han --- drivers/macintosh/macio_asic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index 1943a007e2d5..260fccb3863e 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c @@ -216,9 +216,9 @@ static int macio_resource_quirks(struct device_node *np, struct resource *res, /* Some older IDE resources have bogus sizes */ if (of_node_name_eq(np, "IDE") || of_node_name_eq(np, "ATA") || of_node_is_type(np, "ide") || of_node_is_type(np, "ata")) { - if (index == 0 && (res->end - res->start) > 0xfff) + if (index == 0 && (resource_size(res)) > 0xfff) res->end = res->start + 0xfff; - if (index == 1 && (res->end - res->start) > 0xff) + if (index == 1 && (resource_size(res)) > 0xff) res->end = res->start + 0xff; } return 0; -- 2.17.1